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 -
This commit is contained in:
svenbarth 2014-12-26 18:14:52 +00:00
parent a1ba11ff88
commit 5848637db3
3 changed files with 20 additions and 1 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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
tests/test/tgeneric97.pp Normal file
View File

@ -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.