summary refs log tree commit diff stats
path: root/tests/ccgbugs/twrong_method.nim
blob: 9879c6114a4fb7bacd29bc4883464727d102b267 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
discard """
  cmd: "nim c -d:release $file"
  output: '''correct method'''
"""
# bug #5439
type
  Control* = ref object of RootObj

  ControlImpl* = ref object of Control

  Container* = ref object of ControlImpl

  ContainerImpl* = ref object of Container

method testProc*(control: Control) {.base.} = echo "wrong method"

method testProc*(container: Container) = echo "correct method"

proc main()

main() # wrong method called

proc main() =
  var container = new ContainerImpl
  container.testProc()

# main() # correct method called