tmixin_in_proc.nim 347 B

1234567891011121314151617181920212223
  1. discard """
  2. output: '''monkey'''
  3. """
  4. # bug #5478
  5. template creature*(name: untyped) =
  6. type
  7. name*[T] = object
  8. color: T
  9. proc `init name`*[T](c: T): name[T] =
  10. mixin transform
  11. transform()
  12. creature(Lion)
  13. type Monkey* = object
  14. proc transform*() =
  15. echo "monkey"
  16. var
  17. m: Monkey
  18. y = initLion(m) #this one failed to compile