-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix lower case type name conflicting with variable name #3572
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
Conversation
|
The last failing test is the // Source
public void DiscardedOutVsLambdaParameter()
{
GetOut(out var _);
MakeValue((@_ _) => 5);
}
// Decompiled
public void DiscardedOutVsLambdaParameter()
{
GetOut(out var _);
MakeValue((@_ _2) => 5);
} |
| for (int j = 0; j < 10; j++) | ||
| { | ||
| QualifierTests.i.Test(); | ||
| i.Test(); |
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.
hmm... doesn't this change defeat the purpose of the test?
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.
Are you suggesting this portion of the test be removed?
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.
I would like to keep the test, but it seems we cannot actually test the case where a local variable conflicts with a type name, because AssignVariableNames will no longer use nested type names as variable names :)
|
The issue you are fixing is actually not related to lower-case type names at all, but rather that nested types were not considered previously. This is true for both the nested type I don't see a way to actually make the tests still work with this change. Maybe we should just remove them? |
|
Good now? |
|
Computer says yes! 😆 |
|
Thank you very much for the contribution! |
I forgot to answer the question. Actually, I no longer remember why I wrote it without using LINQ. Not sure, if there ever was a performance problem in that part of the code. |
Problem
Resolves #3571
Solution
AssignVariableNames, I made changes toCollectReservedVariableNames,GenerateForeachVariableName, andGenerateVariableNamefor consistent use betweenCollectAllLowerCaseTypeNames(ITypeDefinition)and the newCollectAllLowerCaseTypeNames(UsingScope).CollectAllLowerCaseTypeNames(UserScope)shouldn't have used Linq? I noticed thatCollectAllLowerCaseMemberNames(ITypeDefinition)avoided Linq, but it made my code more concise and readable.