提交 653ded0f 编写于 作者: G Gen Lu

Check all overloads when inferring first argument in an invocation with nothing typed

上级 bd3a0b49
......@@ -458,10 +458,13 @@ private IEnumerable<TypeInferenceInfo> InferTypeInObjectCreationExpression(BaseO
var info = SemanticModel.GetSymbolInfo(invocation, CancellationToken);
var methods = info.GetBestOrAllSymbols().OfType<IMethodSymbol>();
// Overload resolution (see DevDiv 611477) in certain extension method cases
// can result in GetSymbolInfo returning nothing. In this case, get the
// method group info, which is what signature help already does.
if (info.Symbol == null)
// 1. Overload resolution (see DevDiv 611477) in certain extension method cases
// can result in GetSymbolInfo returning nothing.
// 2. when trying to infer the type of the first argument, it's possible that nothing correspinding to
// the argument is typed and there exists an overload with 0 parameter as a viable match.
// In one of these cases, get the method group info, which is what signature help already does.
if (info.Symbol == null ||
info.Symbol is IMethodSymbol method && method.Parameters.Length == 0)
{
var memberGroupMethods =
SemanticModel.GetMemberGroup(invocation.Expression, CancellationToken)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册