Skip to content

Commit

Permalink
Add test case for C# 12 optional parameters in lambdas.
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Jul 21, 2024
1 parent 67a0bfb commit 82256c4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ICSharpCode.Decompiler.Tests/TestCases/Pretty/OptionalArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
internal class OptionalArguments : List<int>
{
public delegate int D(int p = 10);

public enum MyEnum
{
A,
Expand Down Expand Up @@ -283,5 +285,18 @@ public static void Issue2920p(in int x = 3)
{
}
#endif

#if CS120
public static D LambdaWithOptionalParameter()
{
return (int x = 10) => x;
}

public static void Use(D d)
{
d();
d(42);
}
#endif
}
}

0 comments on commit 82256c4

Please sign in to comment.