Explorar o código

Fix for Mantis #27424.

pgenutil.pas:
  * parse_generic_parameters: a ';' terminates a parameter group, so correctly adjust firstidx in that case

+ added test

git-svn-id: trunk@29685 -
svenbarth %!s(int64=10) %!d(string=hai) anos
pai
achega
04534d5dcf
Modificáronse 3 ficheiros con 28 adicións e 1 borrados
  1. 1 0
      .gitattributes
  2. 5 1
      compiler/pgenutil.pas
  3. 22 0
      tests/webtbs/tw27424.pp

+ 1 - 0
.gitattributes

@@ -14249,6 +14249,7 @@ tests/webtbs/tw2736.pp svneol=native#text/plain
 tests/webtbs/tw2737.pp svneol=native#text/plain
 tests/webtbs/tw2738.pp svneol=native#text/plain
 tests/webtbs/tw2739.pp svneol=native#text/plain
+tests/webtbs/tw27424.pp svneol=native#text/pascal
 tests/webtbs/tw2758.pp svneol=native#text/plain
 tests/webtbs/tw2763.pp svneol=native#text/plain
 tests/webtbs/tw2765.pp svneol=native#text/plain

+ 5 - 1
compiler/pgenutil.pas

@@ -1130,7 +1130,11 @@ uses
               firstidx:=result.count;
 
               constraintdata.free;
-            end;
+            end
+          else
+            if token=_SEMICOLON then
+              { a semicolon terminates a type parameter group }
+              firstidx:=result.count;
         until not (try_to_consume(_COMMA) or try_to_consume(_SEMICOLON));
         block_type:=old_block_type;
       end;

+ 22 - 0
tests/webtbs/tw27424.pp

@@ -0,0 +1,22 @@
+{ %NORUN }
+
+program tw27424;
+
+{$mode objfpc}
+
+type
+  TType = class(TObject)
+  end;
+
+  generic TTest<T1; T2: TType> = class(TObject)
+  end;
+
+  TFoo = class(TType)
+  end;
+
+  TBar = class(specialize TTest<string, TFoo>)
+  end;
+
+begin
+
+end.