summary refs log tree commit diff stats
path: root/tests/method/tautonotgeneric.nim
blob: f0d6932f9e59c36d7071aa7a188af0992880fd8d (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
discard """
  output: '''wof!
wof!'''
"""

# bug #1659
type Animal = ref object {.inheritable.}
type Dog = ref object of Animal

method say(a: Animal): auto {.base.} = "wat!"
method say(a: Dog): auto = "wof!"

proc saySomething(a: Animal): auto = a.say()


method ec(a: Animal): auto {.base.} = echo "wat!"
method ec(a: Dog): auto = echo "wof!"

proc ech(a: Animal): auto = a.ec()


var a = Dog()
echo saySomething(a)
ech a