Fix recursive generic typed defs (#18809)
This commit is contained in:
parent
f373c17ad9
commit
7ae52d7791
2 changed files with 13 additions and 1 deletions
12
tests/generics/trecursivegenerics.nim
Normal file
12
tests/generics/trecursivegenerics.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
block: # Replicates #18728
|
||||
type
|
||||
FlipFlop[A, B] = ref object
|
||||
next: FlipFlop[B, A]
|
||||
|
||||
Trinary[A, B, C] = ref object
|
||||
next: Trinary[B, C, A]
|
||||
|
||||
assert typeof(FlipFlop[int, string]().next) is FlipFlop[string, int]
|
||||
assert typeof(FlipFlop[string, int]().next) is FlipFlop[int, string]
|
||||
assert typeof(Trinary[int, float, string]().next) is Trinary[float, string, int]
|
||||
assert typeof(Trinary[int, float, string]().next.next) is Trinary[string, int, float]
|
||||
Loading…
Add table
Add a link
Reference in a new issue