treturn_var_t.nim 323 B

1234567891011121314151617181920212223242526
  1. discard """
  2. output: '''Inh
  3. 45'''
  4. """
  5. type
  6. Base = ref object of RootObj
  7. field: int
  8. Inh = ref object of Base
  9. # bug #6777
  10. method foo(b: Base): var int {.base.} =
  11. echo "Base"
  12. result = b.field
  13. method foo(b: Inh): var int =
  14. echo "Inh"
  15. result = b.field
  16. var x: Base
  17. var y = Inh(field: 45)
  18. x = y
  19. echo foo(x)