提交 f5ecfcef 编写于 作者: R Ravi Chande

Don't show warning icon for method overloads

Don't show warning icon for differing method overloads between heads,
unless none are available.
上级 82f6a5d6
......@@ -6880,6 +6880,72 @@ void M()
VerifyItemInLinkedFiles(markup, "y", expectedDescription);
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public void MethodOverloadDifferencesIgnored()
{
var markup = @"<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE"">
<Document FilePath=""CurrentDocument.cs""><![CDATA[
class C
{
#if ONE
void Do(int x){}
#endif
#if TWO
void Do(string x){}
#endif
void Shared()
{
$$
}
}
]]>
</Document>
</Project>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO"">
<Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""CurrentDocument.cs""/>
</Project>
</Workspace>";
var expectedDescription = $"void C.Do(string x)";
VerifyItemInLinkedFiles(markup, "Do", expectedDescription);
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public void WarningForSymbolsOfDifferingKind()
{
var markup = @"<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE"">
<Document FilePath=""CurrentDocument.cs""><![CDATA[
class C
{
#if ONE
void Do(int x){}
#endif
#if TWO
int Do;
#endif
void Shared()
{
$$
}
}
]]>
</Document>
</Project>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO"">
<Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""CurrentDocument.cs""/>
</Project>
</Workspace>";
var expectedDescription = $"({FeaturesResources.Field}) int C.Do\r\n\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj1", FeaturesResources.NotAvailable)}\r\n{string.Format(FeaturesResources.ProjectAvailability, "Proj2", FeaturesResources.Available)}\r\n\r\n{FeaturesResources.UseTheNavigationBarToSwitchContext}";
VerifyItemInLinkedFiles(markup, "Do", expectedDescription);
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public void ConditionalAccessWalkUp()
{
......
......@@ -243,7 +243,7 @@ private HashSet<ISymbol> UnionSymbols(List<Tuple<DocumentId, AbstractSyntaxConte
{
// We need to use the SemanticModel any particular symbol came from in order to generate its description correctly.
// Therefore, when we add a symbol to set of union symbols, add a mapping from it to its SyntaxContext.
foreach (var symbol in linkedContextSymbolList.Item3)
foreach (var symbol in linkedContextSymbolList.Item3.GroupBy(s => new { s.ContainingType, s.Name, s.Kind }).Select(g => g.First()))
{
if (set.Add(symbol))
{
......
......@@ -30,14 +30,14 @@ bool IEqualityComparer<ISymbol>.Equals(ISymbol x, ISymbol y)
{
return x.Kind == y.Kind && (x.IsKind(SymbolKind.Local) || x.IsKind(SymbolKind.Label) || x.IsKind(SymbolKind.RangeVariable))
? x.Name == y.Name
: _symbolEquivalenceComparer.Equals(x, y);
: x.Name == y.Name && x.Kind == y.Kind && _symbolEquivalenceComparer.Equals(x.ContainingType, y.ContainingType);
}
int IEqualityComparer<ISymbol>.GetHashCode(ISymbol symbol)
{
return symbol.IsKind(SymbolKind.Local) || symbol.IsKind(SymbolKind.Label) || symbol.IsKind(SymbolKind.RangeVariable)
? symbol.Name.GetHashCode()
: _symbolEquivalenceComparer.GetHashCode(symbol);
: _symbolEquivalenceComparer.GetHashCode(symbol.ContainingType);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册