-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Description
Input code
The following code compiles correctly but causes a name collision in the decompiled code because the local variable name is guessed by the return type of the exampleClass method. The local method name has to be named like the return type in camelCase.
private class ExampleClass
{
}
public void Method()
{
Inner();
ExampleClass exampleClass()
{
return new ExampleClass();
}
void Inner()
{
ExampleClass local = exampleClass();
}
}Erroneous output
Decompiled code:
// ...
void Inner()
{
// exampleClass is ambigues
ExampleClass exampleClass = exampleClass();
}Expected Behavior
Both the local function name and the local variable name share the same scope (from Method), thus the local variable should be selected unambiguously.
Details
- Product in use: ILSpy / ILSpyCmd
- Version in use: ILSpy master branch (96cba4a)