diff --git a/NETGenerator/NETGenerator.cs b/NETGenerator/NETGenerator.cs index 6f835bee5..dafca2091 100644 --- a/NETGenerator/NETGenerator.cs +++ b/NETGenerator/NETGenerator.cs @@ -6741,7 +6741,10 @@ namespace PascalABCCompiler.NETGenerator else { TypeInfo ti = helper.GetTypeReference(value.return_value_type); - ret_type = ti.tp; + if (ti == null && value.return_value_type.name == null)//not used lambda, ignore + ret_type = TypeFactory.VoidType; + else + ret_type = ti.tp; if (IsNeedCorrectGetType(cur_ti, ret_type)) { ret_type = ret_type.MakePointerType(); diff --git a/TestSuite/lambda_delegate.pas b/TestSuite/lambda_delegate.pas new file mode 100644 index 000000000..632b57085 --- /dev/null +++ b/TestSuite/lambda_delegate.pas @@ -0,0 +1,12 @@ +procedure p0(l: System.Delegate) := l.DynamicInvoke(); + +begin + var i := 0; + p0(()-> + begin + i := 2; + Result := true; + + end); + assert(i = 2); +end. \ No newline at end of file