-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
This test should have triggered the duplicate detection on desktop but didn't.
[Fact]
public void TestDynamic()
{
var source = @"
public class C
{
public static void Main()
{
dynamic d1 = 1;
dynamic d2 = 2;
System.Console.Write($""{(d1, 2) == (1, d2)} "");
System.Console.Write($""{(d1, 2) != (1, d2)} "");
System.Console.Write($""{(d1, 20) == (10, d2)} "");
System.Console.Write($""{(d1, 20) != (10, d2)} "");
}
}";
var comp = CreateCompilation(source, references: new[] { CSharpRef, SystemCoreRef }, options: TestOptions.DebugExe);
comp.VerifyDiagnostics();
CompileAndVerify(comp, expectedOutput: "True False False True");
} public static ImmutableArray<MetadataReference> GetReferences(TargetFramework tf, IEnumerable<MetadataReference> additionalReferences)
{
var references = GetReferences(tf);
if (additionalReferences == null)
{
return references;
}
foreach (var r in additionalReferences)
{
if (references.Contains(r))
{
throw new Exception($"Duplicate reference detected {r.Display}");
}
}
return references.AddRange(additionalReferences);
}