From bb78c2d1ea7da2733da5345124aae821efe07dfd Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 4 Jul 2026 13:16:16 +0200 Subject: [PATCH] Add pretty tests for readonly record structs and custom record members readonly record struct had no coverage, and no record overrode a synthesized member; user-declared ToString and PrintMembers pin the synthesized-vs-user member detection. Assisted-by: Claude:claude-fable-5:Claude Code --- .../TestCases/Pretty/Records.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs index 0a10fa8c3..1a88b0f4e 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Records.cs @@ -1,6 +1,7 @@ using System; #if CS100 using System.Runtime.InteropServices; +using System.Text; #endif namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -247,6 +248,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty #if CS100 internal class RecordStructs { + public readonly record struct ReadonlyPoint(int X, int Y); + public record struct Base(string A); public record CopyCtor(string A) @@ -445,5 +448,25 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty } } } + + internal class RecordsWithCustomSynthesizedMembers + { + public record WithCustomToString(int A) + { + public sealed override string ToString() + { + return "custom"; + } + } + + public record WithCustomPrintMembers(int A) + { + protected virtual bool PrintMembers(StringBuilder builder) + { + builder.Append("X"); + return true; + } + } + } #endif }