未验证 提交 05974450 编写于 作者: C Charles Stoner 提交者: GitHub

Consider nullability in ReferenceIndexerBase (#45714)

上级 81d4452e
......@@ -128055,5 +128055,26 @@ public new void M1<T>(System.Nullable<T?> x)
Diagnostic(ErrorCode.ERR_ValConstraintNotSatisfied, "x").WithArguments("System.Nullable<T>", "T", "T").WithLocation(11, 47)
);
}
[Fact]
[WorkItem(44348, "https://github.com/dotnet/roslyn/issues/44348")]
public void Constraints()
{
var source =
@"class A<T, U>
{
internal interface IA { }
internal class C { }
}
#nullable enable
class B<T, U> : A<T, U>
where T : B<T, U>.IB
where U : A<T, U>.C
{
internal interface IB : IA { }
}";
var comp = CreateCompilation(source);
comp.VerifyEmitDiagnostics();
}
}
}
......@@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Roslyn.Utilities;
using EmitContext = Microsoft.CodeAnalysis.Emit.EmitContext;
using Microsoft.CodeAnalysis.Emit;
......@@ -13,8 +12,8 @@ namespace Microsoft.Cci
{
internal abstract class ReferenceIndexerBase : MetadataVisitor
{
private readonly HashSet<IReference> _alreadySeen = new HashSet<IReference>();
private readonly HashSet<IReference> _alreadyHasToken = new HashSet<IReference>();
private readonly HashSet<IReference> _alreadySeen = new HashSet<IReference>(MetadataEntityReferenceComparer.ConsiderEverything);
private readonly HashSet<IReference> _alreadyHasToken = new HashSet<IReference>(MetadataEntityReferenceComparer.ConsiderEverything);
protected bool typeReferenceNeedsToken;
internal ReferenceIndexerBase(EmitContext context)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册