This commit is contained in:
Ivan Bondarev 2021-04-25 11:07:44 +02:00
parent 46c439e99e
commit 008f1f16f7
2 changed files with 25 additions and 1 deletions

5
TestSuite/lambdas16.pas Normal file
View file

@ -0,0 +1,5 @@
begin
var t := System.Threading.Tasks.Task&<byte>.Run(()->byte(2));
t.Wait();
assert(t.Result = 2);
end.

View file

@ -1404,7 +1404,26 @@ namespace PascalABCCompiler.TreeConverter
if (left_func is basic_function_node)
return method_compare.less_method;
else
return method_compare.greater_method;
{
if (left.Count > 0 && right.Count > 0 && left[0].from is delegated_methods && right[0].from is delegated_methods && right[0].to.is_generic_type_instance
&& (left[0].from as delegated_methods).proper_methods[0].ret_type is lambda_any_type_node && (right[0].from as delegated_methods).proper_methods[0].ret_type is lambda_any_type_node)
{
var llist = right_func.get_generic_params_list();
var rlist = right[0].to.instance_params;
if (llist.Count == rlist.Count)
{
for (int i=0; i<llist.Count; i++)
if (llist[i] != rlist[i])
return method_compare.greater_method;
return method_compare.less_method;
}
else
return method_compare.greater_method;
}
else
return method_compare.greater_method;
}
}
if (left_func.is_generic_function_instance && !right_func.is_generic_function_instance)
{