Adjusted the generic implementation to generate the type according to the declaration and not the basis of the type.

This commit is contained in:
Henrique Gottardi Werlang 2021-12-20 14:51:36 -03:00
parent cafaa9f5b8
commit 68f79e0b82

View File

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