compiler: allow generics as class parents + fixed test

git-svn-id: trunk@16708 -
This commit is contained in:
paul 2011-01-05 05:03:21 +00:00
parent bd64575add
commit d55a141d70
2 changed files with 5 additions and 12 deletions

View File

@ -527,14 +527,6 @@ implementation
hasparentdefined:=true;
end;
{ no generic as parents }
if assigned(childof) and
(df_generic in childof.defoptions) then
begin
Message(parser_e_no_generics_as_types);
childof:=nil;
end;
{ if no parent class, then a class get tobject as parent }
if not assigned(childof) then
begin

View File

@ -1,20 +1,21 @@
program Project1;
{$mode objfpc}{$H+}
{$apptype console}
type
{ TStack }
generic TStack<T> = class(TObject)
public
public
procedure Clear; virtual;
destructor Destroy; override;
end;
{ TIntegerStack }
{ TAdvStack }
TAdvStack = class(specialize TStack<T>)
generic TAdvStack<T> = class(specialize TStack<T>)
public
procedure Clear; override;
end;
@ -25,7 +26,7 @@ type
{ TIntegerStack2 }
TIntegerStack2 = class(specialize TAdvStack<Integer>);
TIntegerStack2 = class(specialize TAdvStack<Integer>)
public
procedure Clear; override;
end;