提交 81f806ad 编写于 作者: J Jason Malinowski

Consume the new compiler API for comparing symbols without nullability

Fixes https://github.com/dotnet/roslyn/issues/36044
上级 1ae13032
......@@ -1177,7 +1177,7 @@ private T Goo<T>(T v)
}");
}
[Fact(Skip = "https://github.com/dotnet/roslyn/issues/36044"), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestGenericAssignmentWithNestedNullableReferenceTypeBeingAssignedTo()
{
// Here, we are asserting that the return type of the generated method is T, effectively discarding
......
......@@ -8,7 +8,6 @@ namespace Microsoft.CodeAnalysis
/// <summary>
/// A comparer that compares symbols but ignores nullability, both top-level and nested.
/// </summary>
/// <remarks>This is not implemented correctly, which is being tracked by https://github.com/dotnet/roslyn/issues/36044</remarks>
internal sealed class AllNullabilityIgnoringSymbolComparer : IEqualityComparer<ISymbol>
{
public static readonly IEqualityComparer<ISymbol> Instance = new AllNullabilityIgnoringSymbolComparer();
......@@ -21,9 +20,7 @@ public bool Equals(ISymbol x, ISymbol y)
{
if (x is ITypeSymbol xTypeSymbol && y is ITypeSymbol yTypeSymbol)
{
// TODO: also ignore nested nullability. Right now there is no compiler API to do this, but it's being tracked in https://github.com/dotnet/roslyn/issues/35933.
// The fixing of this code will be tracked by https://github.com/dotnet/roslyn/issues/36044 and tests can then be unskipped there.
return xTypeSymbol.WithoutNullability().Equals(yTypeSymbol.WithoutNullability());
return xTypeSymbol.WithoutNullability().Equals(yTypeSymbol.WithoutNullability(), SymbolEqualityComparer.Default);
}
return object.Equals(x, y);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册