This commit is contained in:
Бондарев Иван 2019-03-31 11:54:53 +02:00
parent d7cbac142d
commit 8435858c4a
2 changed files with 14 additions and 1 deletions

8
TestSuite/generics25.pas Normal file
View 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.

View file

@ -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;
}