未验证 提交 ecf09687 编写于 作者: C CyrusNajmabadi 提交者: GitHub

Merge pull request #47834 from Youssef1313/patch-10

InlineParameterNameHints:  Support record base type
......@@ -360,5 +360,43 @@ class A
Await VerifyParamHints(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.InlineParameterNameHints)>
<WorkItem(47696, "https://github.com/dotnet/roslyn/issues/47696")>
Public Async Function TestRecordBaseType() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
record Base(int Alice, int Bob);
record Derived(int Other) : Base({|Alice:2|}, {|Bob:2|});
</Document>
</Project>
</Workspace>
Await VerifyParamHints(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.InlineParameterNameHints)>
<WorkItem(47696, "https://github.com/dotnet/roslyn/issues/47696")>
Public Async Function TestClassBaseType() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Base
{
public Base(int paramName) {}
}
class Derived : Base
{
public Derived() : base({|paramName:20|}) {}
}
</Document>
</Project>
</Workspace>
Await VerifyParamHints(input)
End Function
End Class
End Namespace
......@@ -49,18 +49,14 @@ public static RefKind GetRefKind(this ArgumentSyntax argument)
bool allowParams = false,
CancellationToken cancellationToken = default)
{
if (!(argument.Parent is BaseArgumentListSyntax argumentList))
{
return null;
}
if (!(argumentList.Parent is ExpressionSyntax invocableExpression))
if (argument.Parent is not BaseArgumentListSyntax argumentList ||
argumentList.Parent is null)
{
return null;
}
// Get the symbol as long if it's not null or if there is only one candidate symbol
var symbolInfo = semanticModel.GetSymbolInfo(invocableExpression, cancellationToken);
var symbolInfo = semanticModel.GetSymbolInfo(argumentList.Parent, cancellationToken);
var symbol = symbolInfo.Symbol;
if (symbol == null && symbolInfo.CandidateSymbols.Length == 1)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册