From 2d9bbce63ca07e43b1e9cf98ec28abeb58e9dcdc Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 4 Jul 2026 13:12:46 +0200 Subject: [PATCH] Add pretty tests for nested anonymous-type members Anonymous types nested as members of other anonymous types (and read back through the projection), ToString on an anonymous instance, and explicit member projections were not covered. Assisted-by: Claude:claude-fable-5:Claude Code --- .../TestCases/Pretty/AnonymousTypes.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.cs index a2c2c02dc..6a79c601b 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.cs @@ -110,5 +110,28 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { v = init; } + + private static string NestedAnonymousTypeMembers() + { + var anon = new { + Outer = new { + Inner = 1 + }, + Arr = new[] { + new { + X = 1 + } + } + }; + return anon.Outer.Inner + anon.ToString() + anon.Arr[0].X; + } + + private static object MemberProjection(Version v) + { + return new { + Major = v.Major, + Renamed = v.Minor + }; + } } }