twrong_method.nim 539 B

12345678910111213141516171819202122232425262728
  1. discard """
  2. cmd: "nim c -d:release $file"
  3. output: '''correct method'''
  4. """
  5. # bug #5439
  6. type
  7. Control* = ref object of RootObj
  8. ControlImpl* = ref object of Control
  9. Container* = ref object of ControlImpl
  10. ContainerImpl* = ref object of Container
  11. method testProc*(control: Control) {.base.} = echo "wrong method"
  12. method testProc*(container: Container) = echo "correct method"
  13. proc main()
  14. main() # wrong method called
  15. proc main() =
  16. var container = new ContainerImpl
  17. container.testProc()
  18. # main() # correct method called