bug fix #240
This commit is contained in:
parent
1d6dfe245a
commit
132b1e2de2
18
TestSuite/params10.pas
Normal file
18
TestSuite/params10.pas
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function f<T>(params a: array of T): array of T;
|
||||
begin
|
||||
Result := a;
|
||||
end;
|
||||
|
||||
function f2<T>(b: T; params a: array of T): array of T;
|
||||
begin
|
||||
Result := a;
|
||||
end;
|
||||
|
||||
begin
|
||||
var a := new integer[3](1,2,3);
|
||||
var b: array of integer;
|
||||
b := f(a);
|
||||
assert(b[0] = 1);
|
||||
b := f2(2, a);
|
||||
assert(b[1] = 2);
|
||||
end.
|
||||
|
|
@ -809,7 +809,10 @@ namespace PascalABCCompiler.TreeRealization
|
|||
for (int i = formal_count - 1; i < fact_count; ++i)
|
||||
{
|
||||
//Проверяем фактические, попадающие под params...
|
||||
if (!DeduceInstanceTypes(last_params_type, fact[i].type, deduced, nils))
|
||||
type_node tn = fact[i].type;
|
||||
if (tn.element_type != null && tn.type_special_kind != SemanticTree.type_special_kind.array_wrapper)
|
||||
tn = tn.element_type;
|
||||
if (!DeduceInstanceTypes(last_params_type, tn, deduced, nils))
|
||||
{
|
||||
if (alone)
|
||||
throw new SimpleSemanticError(loc, "GENERIC_FUNCTION_{0}_CAN_NOT_BE_CALLED_WITH_THESE_PARAMETERS", func.name);
|
||||
|
|
|
|||
Loading…
Reference in a new issue