提交 186cb29d 编写于 作者: C Cyrus Najmabadi

Don't report cref references as a 'getter' reference.

上级 f45b1eaf
......@@ -895,6 +895,40 @@ class D
Await TestStreamingFeature(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpAccessor_Get_Cref() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface IC
{
/// &lt;see cref="Prop"/&gt;
int Prop { {|Definition:$$get|}; set; }
}
</Document>
</Project>
</Workspace>
Await TestStreamingFeature(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpAccessor_Set_Cref() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface IC
{
/// &lt;see cref="Prop"/&gt;
int Prop { get; {|Definition:$$set|}; }
}
</Document>
</Project>
</Workspace>
Await TestStreamingFeature(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestVBAccessor_Get_Feature1() As Task
Dim input =
......
......@@ -893,5 +893,22 @@ End Class
</Workspace>
Await TestAPIAndFeature(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpProperty_Cref() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface IC
{
/// &lt;see cref="[|Prop|]"/&gt;
int {|Definition:$$Prop|} { get; set; }
}
</Document>
</Project>
</Workspace>
Await TestStreamingFeature(input)
End Function
End Class
End Namespace
......@@ -81,9 +81,18 @@ protected AbstractMethodOrPropertyOrEventSymbolReferenceFinder()
}
else
{
// Wasn't written. This could be a normal read, or used through something
// like nameof().
return semanticFacts.IsInsideNameOfExpression(model, node, cancellationToken)
// Wasn't written. This could be a normal read, or it could be neither a read nor
// write. Example of this include:
//
// 1) referencing through something like nameof().
// 2) referencing in a cref in a doc-comment.
//
// This list is thought to be complete. However, if new examples are found, they
// can be added here.
var inNameOf = semanticFacts.IsInsideNameOfExpression(model, node, cancellationToken);
var inStructuredTrivia = node.IsPartOfStructuredTrivia();
return inNameOf || inStructuredTrivia
? ImmutableArray<IMethodSymbol>.Empty
: ImmutableArray.Create(property.GetMethod);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册