Registry Mirror
Skip to content

Conversation

@siegfriedpammer

Copy link
Copy Markdown
Member

Tests only. Twenty deconstruction shapes that no fixture covered, so a future change to
DeconstructionTransform cannot drop them silently:

  • nesting at three levels, and nesting at position 0 rather than last
  • inner discards on either side of a nested designation
  • nested designations whose targets are properties, and no-conversion nested targets
  • property and static-property targets fetched in reverse order
  • mixed local-and-field targets, indexer sources, tuple-field sources
  • deconstruction inside try, inside a switch case, in if/else, and in a while loop
  • a three-element tuple deconstructed in a foreach over a list

Nineteen of them already decompile correctly. They are checked in as-is - this is regression
coverage for behaviour that works today, not a change in behaviour.

The twentieth

Two back-to-back deconstructions of the same source in one method are not recognized. Filed as
#4059 and checked in commented out with a pointer to it, the way
ArrayAssign_FloatToDoubleConversion_Custom is already handled in this fixture, rather than left
as a red test.

// what ILSpy emits today
GetSource().Deconstruct(out var a, out var b);
...
GetSource().Deconstruct(out b, out a);   // same locals, opposite order

csc reuses the same out-slot temporaries for both calls, so neither matches a transform that
expects the pattern to own its locals.

Provenance

These shapes come from an unpushed local branch that predates #3949 and #3950, the PRs that
actually fixed #3275 and #3388. Its fix is long superseded - both issues decompile correctly on
master, verified against that branch's own fixtures - but its test coverage never landed. This is
that coverage, ported and re-checked against the current implementation.

Verification

ICSharpCode.Decompiler.Tests: 3490 total, 0 failed, 45 skipped. DeconstructionTests runs on
eight compiler configurations (Roslyn 2.10, 3.11, 4.14 and latest, each with and without
Optimize); the failing case above failed on all eight before being commented out, so it is not
compiler-version specific.

Written by an AI agent (Claude) on Siegfried's behalf.

Twenty shapes that no fixture covered: nesting at depth three and at position
zero, inner discards on either side, property and no-conversion targets, and
deconstruction inside try, switch, if/else and while. All but one already
decompile correctly - they are checked in so a future change to
DeconstructionTransform cannot silently drop them.

The one that does not is left commented out with a pointer to #4059 rather than
as a red test: two back-to-back deconstructions share their out-slot
temporaries, and neither is recognized.

#4059

Assisted-by: Claude:claude-opus-5[1m]:Claude Code
@siegfriedpammer
siegfriedpammer merged commit a980639 into master Aug 26, 2026
17 checks passed
@siegfriedpammer
siegfriedpammer deleted the tests/deconstruction-shape-coverage branch August 27, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ILSpy crashes when it parses deconstruction constructs

1 participant