fixes a multimethod regression

This commit is contained in:
Andreas Rumpf 2017-02-24 13:02:36 +01:00
commit f8914cc3b0
3 changed files with 33 additions and 8 deletions

View file

@ -1,15 +1,24 @@
discard """
output: "wof!"
output: '''wof!
wof!'''
"""
# bug #1659
type Animal = ref object {.inheritable.}
type Dog = ref object of Animal
method say(a: Animal): auto = "wat!"
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