mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
added missing test for methods
This commit is contained in:
21
tests/method/tnildispatcher.nim
Normal file
21
tests/method/tnildispatcher.nim
Normal file
@@ -0,0 +1,21 @@
|
||||
discard """
|
||||
outputsub: '''Error: unhandled exception: cannot dispatch; dispatcher is nil [NilAccessError]'''
|
||||
exitcode: 1
|
||||
"""
|
||||
# bug #5599
|
||||
type
|
||||
Base = ref object of RootObj
|
||||
Derived = ref object of Base
|
||||
|
||||
method inner(obj: Base) {.base.} =
|
||||
quit "to override"
|
||||
|
||||
method outer(obj: Base) {.base.} =
|
||||
echo "outer"
|
||||
obj.inner()
|
||||
|
||||
method inner(obj: Derived) =
|
||||
echo "inner Derived"
|
||||
|
||||
var x: Derived
|
||||
x.outer()
|
||||
Reference in New Issue
Block a user