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 = (
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;