ttypedesc3.nim 453 B

123456789101112131415161718192021222324252627282930
  1. discard """
  2. output: '''
  3. proc Base
  4. proc Child
  5. method Base
  6. yield Base
  7. yield Child
  8. '''
  9. """
  10. import typetraits
  11. type
  12. Base = object of RootObj
  13. Child = object of Base
  14. proc pr(T: type[Base]) = echo "proc " & T.name
  15. method me(T: type[Base]) = echo "method " & T.name
  16. iterator it(T: type[Base]): auto = yield "yield " & T.name
  17. Base.pr
  18. Child.pr
  19. Base.me
  20. when false:
  21. Child.me #<- bug #2710
  22. for s in Base.it: echo s
  23. for s in Child.it: echo s #<- bug #2662