test for #2094
This commit is contained in:
parent
8c198adedc
commit
e39f1cadca
24
TestSuite/lambdas8.pas
Normal file
24
TestSuite/lambdas8.pas
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
var l: List<integer>;
|
||||||
|
|
||||||
|
procedure p1<T>(f: ()->T);
|
||||||
|
begin
|
||||||
|
f();
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
p1(()->
|
||||||
|
begin
|
||||||
|
Result := new class(l := new List<integer>);
|
||||||
|
|
||||||
|
loop 1 do // обязательно цикл loop for или foreach
|
||||||
|
begin
|
||||||
|
|
||||||
|
Result.l := new List<integer>;
|
||||||
|
Result.l.Add(0);
|
||||||
|
var o := Result.l;
|
||||||
|
l := Result.l;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end);
|
||||||
|
assert(l[0] = 0);
|
||||||
|
end.
|
||||||
Loading…
Reference in a new issue