mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 21:09:24 +02:00
* when parsing generic parameter types allow the use of generics that are part of the current specialization stack (this can be the case if a generic is used inside itself as a type parameter for a specialization)
+ added tests
This commit is contained in:
parent
9b63123bf0
commit
dedc018beb
@ -594,6 +594,7 @@ uses
|
||||
if validparam then
|
||||
begin
|
||||
if tstoreddef(typeparam.resultdef).is_generic and
|
||||
not is_or_belongs_to_current_genericdef(typeparam.resultdef) and
|
||||
(
|
||||
not parse_generic or
|
||||
not defs_belong_to_same_generic(typeparam.resultdef,current_genericdef)
|
||||
|
21
tests/test/tgeneric117.pp
Normal file
21
tests/test/tgeneric117.pp
Normal file
@ -0,0 +1,21 @@
|
||||
{ %NORUN }
|
||||
|
||||
program tgeneric117;
|
||||
|
||||
{$mode delphi}
|
||||
|
||||
type
|
||||
TTest<T> = class
|
||||
public type
|
||||
TT = ^TTest<T>;
|
||||
end;
|
||||
|
||||
TTest2<T> = class
|
||||
public type
|
||||
TT2 = TTest2<T>;
|
||||
TT = TTest<TT2>;
|
||||
end;
|
||||
|
||||
begin
|
||||
|
||||
end.
|
21
tests/test/tgeneric118.pp
Normal file
21
tests/test/tgeneric118.pp
Normal file
@ -0,0 +1,21 @@
|
||||
{ %NORUN }
|
||||
|
||||
program tgeneric117;
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
type
|
||||
generic TTest<T> = class
|
||||
public type
|
||||
TT = ^specialize TTest<T>;
|
||||
end;
|
||||
|
||||
generic TTest2<T> = class
|
||||
public type
|
||||
TT2 = specialize TTest2<T>;
|
||||
TT = specialize TTest<TT2>;
|
||||
end;
|
||||
|
||||
begin
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user