Merge branch 'Pas2Js_Generic_Fix' into 'main'

Fixed generics generation in Pas2Js

See merge request freepascal.org/fpc/source!100
This commit is contained in:
Henrique Gottardi Werlang 2025-04-03 21:05:59 -03:00
commit 8e0b6ced58

View File

@ -1470,7 +1470,8 @@ type
TPRResolveAlias = (
prraNone, // do not resolve alias
prraSimple, // resolve alias, but not type alias
prraAlias // resolve alias and type alias
prraAlias, // resolve alias and type alias
prraHighType
);
TPRProcTypeDescFlag = (
@ -24314,6 +24315,11 @@ begin
if IsSameType(Arg1Resolved.HiTypeEl,Arg2Resolved.HiTypeEl,prraSimple) then
exit(cExact);
end
else if ResolveAlias=prraHighType then
begin
if IsSameType(Arg1Resolved.HiTypeEl,Arg2Resolved.HiTypeEl,prraNone) then
exit(cExact);
end
else
begin
if IsSameType(Arg1Resolved.LoTypeEl,Arg2Resolved.LoTypeEl,prraNone) then
@ -29220,8 +29226,8 @@ begin
begin
Param:=TPasElement(Params[i]);
ComputeElement(Param,ResolvedEl,[rcType]);
ParamsResolved[i]:=ResolvedEl.LoTypeEl;
if ResolvedEl.LoTypeEl<>TPasType(GenericTemplateList[i]) then
ParamsResolved[i]:=ResolvedEl.HiTypeEl;
if ResolvedEl.HiTypeEl<>TPasType(GenericTemplateList[i]) then
IsSelf:=false;
end;
if IsSelf then
@ -29244,7 +29250,7 @@ begin
while j>=0 do
begin
if not IsSameType(Item.Params[j],ParamsResolved[j],prraNone)
and (CheckElTypeCompatibility(Item.Params[j],ParamsResolved[j],prraNone)>cExact) then
and (CheckElTypeCompatibility(Item.Params[j],ParamsResolved[j],prraHighType)>cExact) then
break;
dec(j);
end;