-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Fix mapping of redeclared type parameters #86353
Conversation
I'll leave reviewing this to Vitek, but I have a general question: When ILLink was in a separate repo, the approach we had was that things got fixed in ILLink repo and at some point we'd go, copy the files from linker repo over to ReferenceSource directories in this repo and apply the diffs manually. ILLink is now here so it's feasible to just update these in one go, but we didn't fully catch up with other changes. Changing things now will make ReferenceSource diffs harder to apply. The question I have is whether we'd want to prioritize catching up and deleting ReferenceSource. |
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas Issue DetailsPorted over from dotnet/linker#3167, and fixed in ILCompiler as well. We were skipping the type parameter mapping of compiler-generated types whose only generic parameters were those implicitly created for the declaring type's type parameters. For the testcase in question, the nested state machine inherited a generic parameter from the display class. This was causing unnecessary warnings in a field assignment that assigned Fixes the issue mentioned in dotnet/roslyn#46646 (comment).
|
Seems like a good idea to me. I can work on this if @vitek-karas hasn't already started. |
The source code should be very close for the most part. I did a sync before I started working on test bringup. As we do this I would like to think about sharing the code for real. This will obviously require some additional effort, but currently the amount of code which needs to be synced is pretty big. It's definitely good that it looks similar, but true sharing would be even better. |
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.
Ported over from dotnet/linker#3167, and fixed in ILCompiler as well.
We were skipping the type parameter mapping of compiler-generated types whose only generic parameters were those implicitly created for the declaring type's type parameters.
For the testcase in question, the nested state machine inherited a generic parameter from the display class. This was causing unnecessary warnings in a field assignment that assigned
this
(an instance of the display class) to a field on the state machine. In IL, that assignment references a field type likeDisplayClass<T>
whereT
is the generic parameter on the state machine. Here we were properly mapping type parameters of the display class back to the annotated enclosing method's type parameters, so we could tell that the "target" requiredPublicMethods
. But the substitutedT
from the state machine was not mapped, causing the mismatch.Fixes the issue mentioned in dotnet/roslyn#46646 (comment).