From 82256c47fb9bbab59314e12c4b8a000a925d5059 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 21 Jul 2024 11:36:01 +0200 Subject: [PATCH] Add test case for C# 12 optional parameters in lambdas. --- .../TestCases/Pretty/OptionalArguments.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/OptionalArguments.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/OptionalArguments.cs index f68b896d0..82cda462b 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/OptionalArguments.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/OptionalArguments.cs @@ -24,6 +24,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { internal class OptionalArguments : List { + public delegate int D(int p = 10); + public enum MyEnum { A, @@ -283,5 +285,18 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { } #endif + +#if CS120 + public static D LambdaWithOptionalParameter() + { + return (int x = 10) => x; + } + + public static void Use(D d) + { + d(); + d(42); + } +#endif } }