Browse Source

Add unit test for lamba function

pull/3470/head
ds5678 8 months ago committed by Jeremy Pritts
parent
commit
8736d9891b
  1. 8
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/OptionalArguments.cs
  2. 2
      ICSharpCode.Decompiler/TypeSystem/TypeSystemExtensions.cs

8
ICSharpCode.Decompiler.Tests/TestCases/Pretty/OptionalArguments.cs

@ -308,11 +308,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{ {
} }
#endif #endif
public static void Issue3469([Optional][DefaultParameterValue(0)] int i, [Optional] DateTime d) public static void Issue3469a([Optional][DefaultParameterValue(0)] int i, [Optional] DateTime d)
{ {
} }
#if CS120 #if CS120
public static Action<int, DateTime> Issue3469b()
{
return ([Optional][DefaultParameterValue(0)] int i, [Optional] DateTime d) => {
};
}
public static D LambdaWithOptionalParameter() public static D LambdaWithOptionalParameter()
{ {
return (int x = 10) => x; return (int x = 10) => x;

2
ICSharpCode.Decompiler/TypeSystem/TypeSystemExtensions.cs

@ -629,7 +629,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
return false; return false;
if (parameter.Owner == null) if (parameter.Owner == null)
return true; return true; // Shouldn't happen, but we need to check for it.
for (int i = parameter.Owner.Parameters.Count - 1; i >= 0; i--) for (int i = parameter.Owner.Parameters.Count - 1; i >= 0; i--)
{ {

Loading…
Cancel
Save