fix #1684
This commit is contained in:
parent
d7cbac142d
commit
8435858c4a
8
TestSuite/generics25.pas
Normal file
8
TestSuite/generics25.pas
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
function f1 := 1;
|
||||
function f2(params a: array of integer) := 2;
|
||||
|
||||
begin
|
||||
var a := Arr(f1, f2);
|
||||
assert(a[0] = 1);
|
||||
assert(a[1] = 2);
|
||||
end.
|
||||
|
|
@ -796,7 +796,12 @@ namespace PascalABCCompiler.TreeRealization
|
|||
//Проверяем фактические, попадающие под params...
|
||||
if (!DeduceInstanceTypes(last_params_type, fact[i].type, deduced, nils))
|
||||
{
|
||||
if (alone)
|
||||
if (alone && fact[i].type is delegated_methods && (fact[i].type as delegated_methods).empty_param_method != null)
|
||||
{
|
||||
if (DeduceInstanceTypes(last_params_type, (fact[i].type as delegated_methods).empty_param_method.type, deduced, nils))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
throw new SimpleSemanticError(loc, "GENERIC_FUNCTION_{0}_CAN_NOT_BE_CALLED_WITH_THESE_PARAMETERS", func.name);
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue