提交 3d943fe2 编写于 作者: M Martin Strecker

Type parameters always match the argument type.

上级 244cca77
...@@ -698,6 +698,7 @@ void M1() ...@@ -698,6 +698,7 @@ void M1()
[WorkItem(21446, "https://github.com/dotnet/roslyn/issues/21446")] [WorkItem(21446, "https://github.com/dotnet/roslyn/issues/21446")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddParameter)] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddParameter)]
[Trait("TODO", "Fix broken")]
public async Task TestInvocationLambda1() public async Task TestInvocationLambda1()
{ {
await TestInRegularAndScriptAsync( await TestInRegularAndScriptAsync(
...@@ -721,6 +722,7 @@ void M1() ...@@ -721,6 +722,7 @@ void M1()
a(2); a(2);
} }
}"); }");
//Should be Action<int> a = (int v) => { };
} }
[WorkItem(21446, "https://github.com/dotnet/roslyn/issues/21446")] [WorkItem(21446, "https://github.com/dotnet/roslyn/issues/21446")]
...@@ -904,13 +906,13 @@ void M2() ...@@ -904,13 +906,13 @@ void M2()
@" @"
class C1 class C1
{ {
void M1<T>(int v, T arg) { } void M1<T>(T arg, int v) { }
void M2() void M2()
{ {
M1(1, 2); 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")] [WorkItem(21446, "https://github.com/dotnet/roslyn/issues/21446")]
...@@ -1129,7 +1131,7 @@ void M2() ...@@ -1129,7 +1131,7 @@ void M2()
@" @"
class C1 class C1
{ {
void M1<T>(int v, T i) { } void M1<T>(T i, bool v) { }
void M2() void M2()
{ {
M1<int, bool>(1, true); M1<int, bool>(1, true);
......
...@@ -557,6 +557,11 @@ private int NonParamsParameterCount(IMethodSymbol method) ...@@ -557,6 +557,11 @@ private int NonParamsParameterCount(IMethodSymbol method)
return type.IsReferenceType || type.IsNullable(); return type.IsReferenceType || type.IsNullable();
} }
if (type.Kind == SymbolKind.TypeParameter)
{
return true;
}
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册