Skip to content

Commit

Permalink
Type parameters always match the argument type.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaStr11 committed Sep 27, 2017
1 parent 244cca7 commit 3d943fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ void M1()

[WorkItem(21446, "https://github.com/dotnet/roslyn/issues/21446")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddParameter)]
[Trait("TODO", "Fix broken")]
public async Task TestInvocationLambda1()
{
await TestInRegularAndScriptAsync(
Expand All @@ -721,6 +722,7 @@ void M1()
a(2);
}
}");
//Should be Action<int> a = (int v) => { };
}

[WorkItem(21446, "https://github.com/dotnet/roslyn/issues/21446")]
Expand Down Expand Up @@ -904,13 +906,13 @@ void M2()
@"
class C1
{
void M1<T>(int v, T arg) { }
void M1<T>(T arg, int v) { }
void M2()
{
M1(1, 2);
}
}");
//Should fix to either: void M1<T>(T arg, int v) { } or void M1<T>(T arg, T v) { }
//Should fix to: void M1<T>(T arg, T v) { }
}

[WorkItem(21446, "https://github.com/dotnet/roslyn/issues/21446")]
Expand Down Expand Up @@ -1129,7 +1131,7 @@ void M2()
@"
class C1
{
void M1<T>(int v, T i) { }
void M1<T>(T i, bool v) { }
void M2()
{
M1<int, bool>(1, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,11 @@ private bool TypeInfoMatchesType(
return type.IsReferenceType || type.IsNullable();
}

if (type.Kind == SymbolKind.TypeParameter)
{
return true;
}

return false;
}

Expand Down

0 comments on commit 3d943fe

Please sign in to comment.