From a1420dd311432ac8a37d2cad91a95fd46d3cd4a8 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 4 Jul 2026 13:15:26 +0200 Subject: [PATCH] Add pretty test for dictionary index initializers The C# 6 index-initializer syntax was only covered through custom indexers; a real Dictionary<,> initialized with [key] = value pins the choice between the index form and the Add form. Assisted-by: Claude:claude-fable-5:Claude Code --- .../TestCases/Pretty/InitializerTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs index 1391e32d8..bf60c684b 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs @@ -1257,6 +1257,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests } #if CS60 + public static void RealDictionaryIndexInitializer() + { + X(Y(), new Dictionary { + ["a"] = 1, + ["b"] = GetInt() + }); + } + public static void SimpleDictInitializer() { X(Y(), new Data {