mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 17:47:56 +02:00

Always define nested types of a generic as generic as well. * symtable.pas: + Add a function which decides whether two defs belong to the same generic. * Fix sym_is_owned_by as there can be corner cases where childsym becomes Nil. * ptype.pas: * record_dec: Always define nested types of a generic as generic as well. * single_type & read_named_type.expr_type: Use the newly added function to improve the checks whether a generic symbol should be rejected as "generics not allowed for types of variables or fields". + Add a test for which the improved checks are necessary. git-svn-id: trunk@20189 -
23 lines
277 B
ObjectPascal
23 lines
277 B
ObjectPascal
{ %NORUN }
|
|
|
|
{ This tests that nested types can reference each other inside a generic }
|
|
program tgeneric73;
|
|
|
|
{$mode objfpc}
|
|
|
|
type
|
|
generic TTest<T> = class
|
|
public type
|
|
TSubClass1 = class
|
|
|
|
end;
|
|
|
|
TSubClass2 = class
|
|
f: TSubClass1;
|
|
end;
|
|
end;
|
|
|
|
begin
|
|
|
|
end.
|