tmapper.nim 540 B

12345678910111213141516171819202122232425262728293031
  1. discard """
  2. errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tmapper.nim(22, 7)"
  3. line: 25
  4. """
  5. # bug #2590
  6. type
  7. Console* = ref object
  8. mapper*: Mapper
  9. Mapper* = ref object of RootObj
  10. Mapper2* = ref object of Mapper
  11. proc newMapper2*: Mapper2 =
  12. new result
  13. proc newMapper*: Mapper =
  14. result = newMapper2()
  15. method step*(m: Mapper2) {.base.} =
  16. echo "Mapper2"
  17. method step*(m: Mapper) {.base.} =
  18. echo "Mapper"
  19. var console = Console()
  20. console.mapper = newMapper()
  21. console.mapper.step()