-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Unblock type forwarding scenarios involving extensions #79905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1353,6 +1353,29 @@ public class Inner | |
| CheckForwarderEmit(source1, source2, "NS.Forwarded", "NS.Forwarded+Inner"); | ||
| } | ||
|
|
||
| [ClrOnlyFact] | ||
| [WorkItem("https://github.com/dotnet/roslyn/issues/79894")] | ||
| [WorkItem("https://github.com/dotnet/roslyn/issues/78963")] | ||
| public void Extensions_01() | ||
| { | ||
| var source1 = @" | ||
| public static class Extensions | ||
| { | ||
| extension(int) | ||
| { | ||
| } | ||
| }"; | ||
|
|
||
| var source2 = @" | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Extensions))] | ||
| "; | ||
|
|
||
| // https://github.com/dotnet/roslyn/issues/78963 - The grouping and marker types should be among the forwarded types since they are public. | ||
| // They also should be among exported types for library built from source1. Type symbols | ||
| // representing extensions from the language perspective should not be in either set. | ||
| CheckForwarderEmit(source1, source2, "Extensions"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the extension members are not forwarded in this temporary fix? That sounds like that wouldn't actually "unblock" anyone since they would get a similar effect just by removing the TypeForwardedToAttribute
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Since no one references them in executable code, that should be fine because design time binds to the real declaration wherever it was moved
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Note that we are not forwarding grouping and marker types, but the attribute is on the enclosing type and that type is forwarded |
||
| } | ||
|
|
||
| [ClrOnlyFact] | ||
| public void EmitForwarder_Nested_Private() | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: it doesn't seem like this needs to only be run on Clr hosts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note to #79615 (comment) to audit this class for conditional facts that don't need to be conditional.