C#7 local function generated structures shouldn't be declared as static #13191
Labels
Area-Compilers
Community
The pull request was submitted by a contributor who is not a Microsoft employee.
New Language Feature - Local Functions
Local Functions
Milestone
Version Used: dev15 preview 3
Steps to Reproduce: I compile code from this blog post.
Actual Behavior: The structure generated under the wood by the compiler to handle
localVar
is declared as static (and the fieldlocalVar
is a non-static field)Expected Behavior: Such generated structure shouldn't be declared as static.
As the developer of a static analyzer that churns IL code this matters. Unless there is a real technical reason for declaring such structure as static, it'd be cleaner to not do so.
Note: Reflector see the structure as a static class that derives from value type (it is a Reflector bug that it doesn't tell it is a structure).
Our static analyzer that relies on Cecil for IL read, shows that the generated structure is both abstract and sealed (which means static).
The text was updated successfully, but these errors were encountered: