Skip to content
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

Add option to always fully qualify type names with global:: #2762

Merged
merged 3 commits into from Aug 30, 2022

Conversation

hexafluoride
Copy link
Contributor

@hexafluoride hexafluoride commented Aug 8, 2022

Link to issue(s) this covers
N/A

Problem

There is no option to always fully qualify type names to the strongest extent: even AlwaysQualifyMemberReferences | !UsingDeclarations omits the use of global::. This can be a problem when dealing with name confusion such as in this SO answer. I haven't been able to quickly generate a repro case, but anecdotally, using this option has resolved a number of cases in which the ILSpy generated code will not compile. In general, when compilability of generated code is a goal, this option seems like it would be handy to have.

Of note is that StringInterpolation will probably need to be set to false when this option is enabled, as the C# compiler confuses the colon in "global::" for a formatting specifier. Perhaps it's possible to also emit surrounding braces when global:: is used inside of a string interpolation argument, which is a consideration regardless of this option.

@siegfriedpammer siegfriedpammer added this to the 8.0-preview3 milestone Aug 30, 2022
@siegfriedpammer siegfriedpammer merged commit 2ada0db into icsharpcode:master Aug 30, 2022
@siegfriedpammer
Copy link
Member

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants