Jelajahi Sumber

* better error recovery, resolves #36377

git-svn-id: trunk@43612 -
florian 5 tahun lalu
induk
melakukan
d8f1aacd78
3 mengubah file dengan 23 tambahan dan 1 penghapusan
  1. 1 0
      .gitattributes
  2. 7 1
      compiler/ptype.pas
  3. 15 0
      tests/webtbf/tw36377.pp

+ 1 - 0
.gitattributes

@@ -16087,6 +16087,7 @@ tests/webtbf/tw36114.pp svneol=native#text/pascal
 tests/webtbf/tw36223.pp svneol=native#text/pascal
 tests/webtbf/tw36223.pp svneol=native#text/pascal
 tests/webtbf/tw3626.pp svneol=native#text/plain
 tests/webtbf/tw3626.pp svneol=native#text/plain
 tests/webtbf/tw3631.pp svneol=native#text/plain
 tests/webtbf/tw3631.pp svneol=native#text/plain
+tests/webtbf/tw36377.pp svneol=native#text/pascal
 tests/webtbf/tw3643.pp svneol=native#text/plain
 tests/webtbf/tw3643.pp svneol=native#text/plain
 tests/webtbf/tw3644.pp svneol=native#text/plain
 tests/webtbf/tw3644.pp svneol=native#text/plain
 tests/webtbf/tw3662.pp svneol=native#text/plain
 tests/webtbf/tw3662.pp svneol=native#text/plain

+ 7 - 1
compiler/ptype.pas

@@ -538,7 +538,13 @@ implementation
                 dospecialize:=false;
                 dospecialize:=false;
               end;
               end;
           end;
           end;
-        if dospecialize then
+        { recover from error? }
+        if def.typ=errordef then
+          begin
+            while (token<>_SEMICOLON) and (token<>_RKLAMMER) do
+              consume(token);
+          end
+        else if dospecialize then
           begin
           begin
             if def.typ=forwarddef then
             if def.typ=forwarddef then
               def:=ttypesym(srsym).typedef;
               def:=ttypesym(srsym).typedef;

+ 15 - 0
tests/webtbf/tw36377.pp

@@ -0,0 +1,15 @@
+{ %fail }
+{$mode objfpc}
+
+program test;
+uses
+ FGL;
+
+// Type identifier expected
+// Internal error 2019112401
+generic function CopyList<T>(source: specialize FGL.TFPGObjectList<T>): specialize FGL.TFPGObjectList<T>;
+begin
+end;
+
+begin
+end.