Skip to content

Commit

Permalink
Test type forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
jjonescz committed Aug 2, 2023
1 parent 036a91b commit c4b8474
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,16 @@ public sealed class RequiresLocationAttribute : Attribute

// That breaks the consumer.
CompileAndVerify(source3, new[] { comp1v2Ref, comp2Ref, comp4Ref }, expectedOutput: "True").VerifyDiagnostics();

// Unless the library adds type forwarding.
var source5 = """
using System.Runtime.CompilerServices;
[assembly: TypeForwardedToAttribute(typeof(RequiresLocationAttribute))]
""";
var comp1v3 = CreateCompilation(new[] { source1, source5 }, new[] { comp4Ref }, assemblyName: "Assembly1", options: TestOptions.UnsafeReleaseDll);
comp1v3.VerifyDiagnostics();
var comp1v3Ref = comp1v1.EmitToImageReference();
CompileAndVerify(source3, new[] { comp1v3Ref, comp2Ref, comp4Ref }, expectedOutput: "F123").VerifyDiagnostics();
}

[Fact]
Expand Down

0 comments on commit c4b8474

Please sign in to comment.