This commit is contained in:
parent
20edd487e3
commit
3eb1d2bd85
9
TestSuite/lambdas26.pas
Normal file
9
TestSuite/lambdas26.pas
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
begin
|
||||
var p := (p0: procedure)->
|
||||
begin
|
||||
p0();
|
||||
end;
|
||||
var i := 0;
|
||||
p(()->begin Inc(i) end);
|
||||
assert(i = 1);
|
||||
end.
|
||||
|
|
@ -655,7 +655,12 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
//TODO: А если наследование?
|
||||
possible_type_convertions pct = type_table.get_convertions(en.type,to);
|
||||
|
||||
if (pct.first == null && pct.second == null && en.type is delegated_methods && to.IsDelegate)
|
||||
{
|
||||
pct = type_table.get_convertions(to, en.type);
|
||||
if (pct.first != null)
|
||||
return en;
|
||||
}
|
||||
if (pct.second!=null)
|
||||
{
|
||||
if (pct.second.to == null && en is typed_expression && !to.IsDelegate)
|
||||
|
|
|
|||
Loading…
Reference in a new issue