mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
Deferring an inner deconstruction to its enclosing one used to be decided by matching the enclosing pattern in full, once per inner statement of the same pattern, discarding everything but the end position. The same decisions are available without it. A nested Deconstruct call can only be consumed by an enclosing one that is the immediately preceding statement, looking through the defensive copy of a struct element; anything else in between is a barrier that stops the enclosing from reaching this position, so it matches here instead. That leaves the case where the enclosing call is adjacent but cannot match anyway, which is decided by the constraint MatchDeconstructionCall already places on its out-parameters. The tuple-designation branch no longer needs the position the enclosing run starts at, so the backward walk that searched for it is gone with it. The added fixtures pin reconstruction across adjacent deconstructions, whose element stores that walk used to step through. Assisted-by: Claude:claude-opus-5[1m]:Claude Code Only defer to an enclosing designation that can reach this position The temporaries and element reads of a nested tuple designation are stored back to back, so a statement of any other kind between the temporary and a read of it stops the enclosing pattern from consuming that read. Deferring anyway lost the deconstruction entirely: the enclosing attempt fails and the back-to-front walk does not return to the position that stepped aside for it, so the reads were left as the plain element accesses they came from, which master reconstructs. Assisted-by: Claude:claude-opus-5[1m]:Claude Codepull/3869/merge
2 changed files with 103 additions and 30 deletions
Loading…
Reference in new issue