浏览代码

* fix #39673: also resolve the dummy symbol in case this isn't a reuse of the current generic's name
+ added test

Sven/Sarah Barth 3 年之前
父节点
当前提交
4053d59a2c
共有 2 个文件被更改,包括 31 次插入2 次删除
  1. 1 2
      compiler/ptype.pas
  2. 30 0
      tests/webtbs/tw39673.pp

+ 1 - 2
compiler/ptype.pas

@@ -644,8 +644,7 @@ implementation
                   end
                   end
                 else
                 else
                   begin
                   begin
-                    Message(parser_e_no_generics_as_types);
-                    def:=generrordef;
+                    def:=handle_dummysym(srsym);
                   end;
                   end;
               end
               end
             else if is_classhelper(def) and
             else if is_classhelper(def) and

+ 30 - 0
tests/webtbs/tw39673.pp

@@ -0,0 +1,30 @@
+{ %NORUN }
+
+program tw39673;
+
+{$ifdef fpc}
+{$mode delphi}
+{$else}
+{$APPTYPE CONSOLE}
+{$endif}
+
+uses
+  Types,
+  Classes,
+  contnrs,
+  generics.collections;
+
+Type tsomeclass =class
+                    function readarray:TObjectList;
+end;
+
+{ tsomeclass }
+
+function tsomeclass.readarray: TObjectList;
+begin
+ result:=nil;
+end;
+
+begin
+end.
+