Browse Source

Fix generation of class names for specializations.

symdef.pas, tstoreddef:
  * is_specialization: fix exit condition to correctly recognize specializations

+ added test

git-svn-id: trunk@29328 -
svenbarth 10 years ago
parent
commit
5848637db3
3 changed files with 20 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/symdef.pas
  3. 18 0
      tests/test/tgeneric97.pp

+ 1 - 0
.gitattributes

@@ -11700,6 +11700,7 @@ tests/test/tgeneric93.pp svneol=native#text/pascal
 tests/test/tgeneric94.pp svneol=native#text/pascal
 tests/test/tgeneric95.pp svneol=native#text/pascal
 tests/test/tgeneric96.pp svneol=native#text/pascal
+tests/test/tgeneric97.pp svneol=native#text/pascal
 tests/test/tgoto.pp svneol=native#text/plain
 tests/test/theap.pp svneol=native#text/plain
 tests/test/theapthread.pp svneol=native#text/plain

+ 1 - 1
compiler/symdef.pas

@@ -2116,7 +2116,7 @@ implementation
                sym:=tsym(genericparas[i]);
                if sym.typ<>symconst.typesym then
                  internalerror(2014050904);
-               if sym.owner.defowner=self then
+               if sym.owner.defowner<>self then
                  exit(true);
              end;
            result:=false;

+ 18 - 0
tests/test/tgeneric97.pp

@@ -0,0 +1,18 @@
+program tgeneric97;
+
+{$mode objfpc}
+
+type
+  generic TTest<T> = class
+
+  end;
+
+  TTestLongInt = specialize TTest<LongInt>;
+  TTestString = specialize TTest<AnsiString>;
+
+begin
+  if LowerCase(TTestLongInt.ClassName) <> 'ttest<system.longint>' then
+    halt(1);
+  if LowerCase(TTestString.ClassName) <> 'ttest<system.ansistring>' then
+    halt(2);
+end.