-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Do not return file-local type requested by unmangled metadata name #67183
Do not return file-local type requested by unmangled metadata name #67183
Conversation
It looks like the implementation of this method is calling |
Sorry, I don't understand, you don't like my implementation or what? My logic was that the fact, that file-local type names are mangled makes them completely unusable as well-known types, since when they are loaded from binary metadata later they are not considered special well-known types anymore. Am I not correct? |
I mean to say: I don't know why the bug is occurring here. I'm not innately opposed to your solution. But I'll need to investigate more throughly when I get the chance, hopefully during the coming week. |
Have looked more closely at the scenario. We think the core problem is that for a type like The bug probably originates here: roslyn/src/Compilers/CSharp/Portable/Symbols/NamespaceOrTypeSymbol.cs Lines 316 to 330 in cc8e2f1
We think the condition on line 320 should be modified to also require that the type we found is not a file type in order to match. (We can assume that the candidate type we are looking at is an original definition, i.e. its OriginalDefinition is equal to itself--and it would be good to assert this.) This should eliminate the need for the change to We think that the roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/Source/FileModifierTests.cs Lines 3575 to 3578 in cc8e2f1
We would want to be able to add a new assert like
I think the new test you added in InitOnlyMemberTests will serve as a great end-to-end test showing we are doing the right thing when Let us know if you are willing to take a stab at implementing these changes--otherwise we will try and get to it when we have time. |
Yes
This would completely disable, let's say, and IDE from getting a file-local type directly from the |
I don't think this is going to be the case. Several tests have the following:
So. if a type is looked by its metadata name (as the name of the |
Also, there are many places in the public API one can obtain type symbols. For example, the IDE can obtain a symbol for a file type from the |
My position on behalf of the ide is that GTBMN should follow clr metadata naming rules. |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
It looks like build is failing due to nullable warnings in test files. Consider disabling nullable analysis |
Do we have tests for all the scenarios outlined at #67183 (comment)? |
Done with review pass (commit 3) |
Tagging @AlekseyTs for second review |
src/Analyzers/CSharp/Analyzers/ConvertProgram/ConvertProgramAnalysis_ProgramMain.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/ConvertProgram/ConvertProgramTransform_ProgramMain.cs
Outdated
Show resolved
Hide resolved
Done with review pass (commit 12). |
...rkspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/INamedTypeSymbolExtensions.cs
Outdated
Show resolved
Hide resolved
...rkspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/INamedTypeSymbolExtensions.cs
Outdated
Show resolved
Hide resolved
Done with review pass (commit 13) |
@dotnet/roslyn-ide, @dotnet/roslyn-analysis It looks like the remaining issue in this PR is in Analyzers and Workspaces layers. Please work with @DoctorKrolic towards resolving it to your liking. |
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/CompilationExtensions.cs
Outdated
Show resolved
Hide resolved
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.
IDE side lgtm.
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.
LGTM (commit 15)
@DoctorKrolic Thanks for the contribution |
Fixes: #67079