提交 b3156f46 编写于 作者: B Balaji Krishnan

Merge pull request #10656 from bmay2/fix-1903

Unconstruct method if any type arguments are error types
......@@ -1728,7 +1728,27 @@ void M(IEnumerable<string> args)
args = args.Select(a =>[|b|])
}
}";
await TestAsync(text, "System.Object", testPosition: false);
await TestAsync(text, "System.String", testPosition: false);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(1903, "https://github.com/dotnet/roslyn/issues/1903")]
public async Task TestSelectLambda3()
{
var text =
@"using System.Collections.Generic;
using System.Linq;
class A { }
class B { }
class C
{
IEnumerable<B> GetB(IEnumerable<A> a)
{
return a.Select(i => [|Foo(i)|]);
}
}";
await TestAsync(text, "global::B");
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
......
......@@ -551,7 +551,7 @@ private IMethodSymbol Instantiate(IMethodSymbol method, IList<ITypeSymbol> invoc
// If the method has already been constructed poorly (i.e. with error types for type
// arguments), then unconstruct it.
if (method.TypeArguments.All(t => t.Kind == SymbolKind.ErrorType))
if (method.TypeArguments.Any(t => t.Kind == SymbolKind.ErrorType))
{
method = method.ConstructedFrom;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册