tgenericdotrettype.nim 342 B

123456789101112131415161718192021222324252627282930
  1. discard """
  2. output: '''string
  3. int
  4. (int, string)
  5. '''
  6. """
  7. import typetraits
  8. type
  9. Foo[T, U] = object
  10. x: T
  11. y: U
  12. proc bar[T](a: T): T.U =
  13. echo result.type.name
  14. proc bas(x: auto): x.T =
  15. echo result.type.name
  16. proc baz(x: Foo): (Foo.T, x.U) =
  17. echo result.type.name
  18. var
  19. f: Foo[int, string]
  20. x = bar f
  21. z = bas f
  22. y = baz f