Browse Source

Cover nested deconstruction of record structs with a fixture

Issue #3275 reported an ArgumentOutOfRangeException in
ExpressionBuilder.ConstructTuple for exactly this shape; the crash was
fixed by the nested-deconstruction rework, but no fixture pinned the
record-struct variant, whose Deconstruct methods are compiler-generated.

Assisted-by: Claude:claude-fable-5:Claude Code
pull/3974/head
Siegfried Pammer 1 month ago committed by Siegfried Pammer
parent
commit
caa21049ab
  1. 17
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs

17
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs

@ -285,6 +285,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public record struct PairWithPrimaryCtor<A, B>(A First, B Second); public record struct PairWithPrimaryCtor<A, B>(A First, B Second);
public readonly record struct BoundsInfo(int Profile, Bounds Bounds);
public readonly record struct Bounds(ulong Small, ulong Large);
public record struct PrimaryCtor(int A, string B); public record struct PrimaryCtor(int A, string B);
public record struct MultipleCtorsNoPrimaryCtor public record struct MultipleCtorsNoPrimaryCtor
@ -447,6 +451,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
C = 1.41; C = 1.41;
} }
} }
private static BoundsInfo GetInfo()
{
return new BoundsInfo(1, new Bounds(2uL, 3uL));
}
public static void NestedDeconstruction()
{
var (value, (value2, value3)) = GetInfo();
Console.WriteLine(value);
Console.WriteLine(value2);
Console.WriteLine(value3);
}
} }
internal class RecordsWithCustomSynthesizedMembers internal class RecordsWithCustomSynthesizedMembers

Loading…
Cancel
Save