fcl-passrc: fixed adding specialized type behind array

This commit is contained in:
mattias 2023-05-12 22:12:37 +02:00
parent 12405f9ee4
commit d96f9b8059
2 changed files with 22 additions and 1 deletions

View File

@ -16917,7 +16917,7 @@ var
Last:=TPasElement(List[i]); Last:=TPasElement(List[i]);
if Last is TPasGenericType then if Last is TPasGenericType then
begin begin
if (Last.CustomData<>nil) then if (Last.CustomData is TPasGenericScope) then
begin begin
GenScope:=Last.CustomData as TPasGenericScope; GenScope:=Last.CustomData as TPasGenericScope;
if GenScope.GenericStep>=psgsInterfaceParsed then if GenScope.GenericStep>=psgsInterfaceParsed then

View File

@ -190,6 +190,7 @@ type
procedure TestGenMethod_OverloadArgs; procedure TestGenMethod_OverloadArgs;
procedure TestGenMethod_TypeCastParam; procedure TestGenMethod_TypeCastParam;
procedure TestGenMethod_TypeCastIdentDot; procedure TestGenMethod_TypeCastIdentDot;
procedure TestGenMethod_ParamProcVar_Forward_Issue39216;
end; end;
implementation implementation
@ -3118,6 +3119,26 @@ begin
ParseUnit; ParseUnit;
end; end;
procedure TTestResolveGenerics.TestGenMethod_ParamProcVar_Forward_Issue39216;
begin
StartUnit(false);
Add([
'{$mode delphi}',
'{$modeswitch externalclass}',
'interface',
'type',
' TMyProc<T> = reference to procedure(Arg: T);',
' TMyClass = class;',
' TMyClassArray = array of TMyClass;',
' TMyClass = class external name ''MyClass''',
' public',
' procedure MyProc<T>(MyProcVar: TMyProc<T>);',
' end;',
'implementation',
'']);
ParseUnit;
end;
initialization initialization
RegisterTests([TTestResolveGenerics]); RegisterTests([TTestResolveGenerics]);