mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-03 12:34:44 +00:00
another attempt to make test green again
This commit is contained in:
24
tests/method/tautonotgeneric.nim
Normal file
24
tests/method/tautonotgeneric.nim
Normal file
@@ -0,0 +1,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
|
||||
Reference in New Issue
Block a user