-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Description
LINQ-generation needs to look at all vars in scope when synthesizing a name, not only ilSpy-generated names, but also parameters. If not, you can end up with something like
void fn(int var1) {
... = from var1 in whatever ...
}
where the second var1 is a ilSpy-synthesized name, intended to be unique, making the code uncompilable.
Since this is yet another instance of the same problem that has been observed more than once, perhaps the code synthesizing a new local name should be refactored into a single place, to solve this problem once and for all?
EDIT: Upon close inspection it's not only a LINQ problem, it pops up for nested vars even when turning off LINQ-generation, such as in parameter names for nested lambda's.