tmapping_generic_alias.nim 334 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. output: '''type(c) = GenAlias[system.int]
  3. T = int
  4. seq[int]
  5. '''
  6. """
  7. import typetraits
  8. type
  9. Gen[T] = object
  10. x: T
  11. GenAlias[T] = Gen[seq[T]]
  12. proc f1[T](x: Gen[T]) =
  13. echo T.name
  14. proc f2[T](x: GenAlias[T]) =
  15. echo "type(c) = ", type(x).name
  16. echo "T = ", T.name
  17. f1 x
  18. let
  19. y = Gen[seq[int]](x: @[10])
  20. f2 y