trecursivegenerics.nim 474 B

123456789101112
  1. block: # Replicates #18728
  2. type
  3. FlipFlop[A, B] = ref object
  4. next: FlipFlop[B, A]
  5. Trinary[A, B, C] = ref object
  6. next: Trinary[B, C, A]
  7. assert typeof(FlipFlop[int, string]().next) is FlipFlop[string, int]
  8. assert typeof(FlipFlop[string, int]().next) is FlipFlop[int, string]
  9. assert typeof(Trinary[int, float, string]().next) is Trinary[float, string, int]
  10. assert typeof(Trinary[int, float, string]().next.next) is Trinary[string, int, float]