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

Do not include compiler-generated names in expression names #140

Merged
merged 1 commit into from
Mar 13, 2018

Conversation


// If identifier contains "__", it is "reserved for use by the implementation" and likely compiler-
// or Razor-generated e.g. the name of a field in a delegate's generated class.
if (name.Contains("__"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we need a compat switch to allow this? Seems like a super corner case though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably Razor doesn't stick a CompilerGeneratedAttribute or something along those lines on the member that we could use to infer this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already dealing with an infrequent case. Imaging a scenario where this fix causes a problem is pretty extreme. I don't think the slight change is worth a compat switch. But, I'll ask around…

Roslyn does apply [CompilerGenerated] to its generated classes but not to fields in those classes. So, that attribute doesn't help distinguish <>c__DisplayClass3_0.collection (which is fine) from <>c__DisplayClass5_1,CS$<>8__locals1 (which isn't). and __ is what docs say. (See the last paragraph in this section of the language spec for example.)

@pranavkm
Copy link
Contributor

:shipit:

@dougbu dougbu merged commit b32ab42 into master Mar 13, 2018
@dougbu
Copy link
Member Author

dougbu commented Mar 13, 2018

b32ab42

@dougbu dougbu deleted the dougbu/ignore.compiler.generated.117 branch March 13, 2018 18:49
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.

2 participants