Browse Source

fcl-passrc: fixed adding specialized type behind array

mattias 2 năm trước cách đây
mục cha
commit
d96f9b8059

+ 1 - 1
packages/fcl-passrc/src/pasresolver.pp

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

+ 21 - 0
packages/fcl-passrc/tests/tcresolvegenerics.pas

@@ -190,6 +190,7 @@ type
     procedure TestGenMethod_OverloadArgs;
     procedure TestGenMethod_TypeCastParam;
     procedure TestGenMethod_TypeCastIdentDot;
+    procedure TestGenMethod_ParamProcVar_Forward_Issue39216;
   end;
 
 implementation
@@ -3118,6 +3119,26 @@ begin
   ParseUnit;
 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
   RegisterTests([TTestResolveGenerics]);