* 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:
Sven/Sarah Barth 2024-12-27 16:24:54 +01:00
parent 9b63123bf0
commit dedc018beb
3 changed files with 43 additions and 0 deletions

View File

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