diff --git a/TestSuite/lambdas22.pas b/TestSuite/lambdas22.pas new file mode 100644 index 000000000..78123da6b --- /dev/null +++ b/TestSuite/lambdas22.pas @@ -0,0 +1,9 @@ +begin + var i := 0; + var p: Action0 := ()->begin i := 1 end; + var l := Lst&(); + l.Add(()->begin i := 2 end); + var l2 := l.ConvertAll(a->p); + l2[0](); + assert(i = 1); +end. \ No newline at end of file diff --git a/TestSuite/libs/l2.pas b/TestSuite/libs/l2.pas new file mode 100644 index 000000000..278e37548 --- /dev/null +++ b/TestSuite/libs/l2.pas @@ -0,0 +1,20 @@ +library l2; + +type + + t1 = class + + public function m1 := 0; + + end; + + t2 = class(t1) + public static i: integer; + public static procedure m1; + begin + i := 1; + end; + + end; + +end. \ No newline at end of file diff --git a/TreeConverter/TreeRealization/generics.cs b/TreeConverter/TreeRealization/generics.cs index 72923fb04..5b11e182b 100644 --- a/TreeConverter/TreeRealization/generics.cs +++ b/TreeConverter/TreeRealization/generics.cs @@ -589,6 +589,8 @@ namespace PascalABCCompiler.TreeRealization private static bool CheckIfTypeDependsOnUndeducedGenericParameters(type_node formalType, type_node[] deduced) //lroman { + if (formalType == null) + return false; if (formalType.generic_function_container != null) { var par_num = formalType.generic_param_index;