mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
A local function nested in a lambda can capture closures at two depths: csc emits it as an instance method on the enclosing method's display class that takes the lambda's display class as a parameter. Combining those two capture scopes with FindCommonAncestorInstruction picked the enclosing method, moving the function out of the lambda that owns the deeper closure; the variables captured there were then unreachable and the display-class parameter survived into the output as an undeclared identifier. Nested capture scopes resolve to the innermost instead, which a local function can always see - it reaches the outer closure through the display class it is declared on. Assisted-by: Claude:claude-fable-5:Claude Codepull/4080/head
2 changed files with 39 additions and 1 deletions
Loading…
Reference in new issue