Skip to content

Commit d2d023f

Browse files
When there's a single symbol, it now seems to not be available in candidates
1 parent d4c6bd8 commit d2d023f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

CodeConverter/CSharp/ArgumentConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private CSSyntax.ExpressionSyntax HoistByRefDeclaration(VBSyntax.SimpleArgumentS
147147
private ISymbol GetInvocationSymbol(SyntaxNode invocation)
148148
{
149149
var symbol = invocation.TypeSwitch(
150-
(VBSyntax.InvocationExpressionSyntax e) => _semanticModel.GetSymbolInfo(e).CandidateSymbols
150+
(VBSyntax.InvocationExpressionSyntax e) => _semanticModel.GetAllCandidateSymbols(e)
151151
.OrderByDescending(s => s.GetParameters().Length == e.ArgumentList.Arguments.Count)
152152
.ThenByDescending(s => ParameterMatchScore(s, e.ArgumentList.Arguments))
153153
.FirstOrDefault(),

CodeConverter/Common/SharedSemanticModelExtensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@ public static T GetAncestorOperationOrNull<T>(this SemanticModel semanticModel,
1313

1414
return default;
1515
}
16+
17+
public static ISymbol[] GetAllCandidateSymbols(this SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken))
18+
{
19+
var symbolInfo = semanticModel.GetSymbolInfo(node, cancellationToken);
20+
return [.. symbolInfo.Symbol.YieldNotNull(), .. symbolInfo.CandidateSymbols];
21+
}
1622
}

0 commit comments

Comments
 (0)