tgenericalias.nim 550 B

1234567891011121314151617181920212223
  1. block: # issue #13799
  2. type
  3. X[A, B] = object
  4. a: A
  5. b: B
  6. Y[A] = X[A, int]
  7. template s(T: type X): X = T()
  8. template t[A, B](T: type X[A, B]): X[A, B] = T()
  9. proc works1(): Y[int] = s(X[int, int])
  10. proc works2(): Y[int] = t(X[int, int])
  11. proc works3(): Y[int] = t(Y[int])
  12. proc broken(): Y[int] = s(Y[int])
  13. block: # issue #24415
  14. type GVec2[T] = object
  15. x, y: T
  16. type Uniform[T] = T
  17. proc foo(v: Uniform[GVec2[float32]]): float32 =
  18. result = v.x
  19. let f = GVec2[float32](x: 1.0f, y: 2.0f)
  20. doAssert foo(f) == 1.0f