summary refs log tree commit diff stats
path: root/tests/method/tnildispatcher.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/method/tnildispatcher.nim')
-rw-r--r--tests/method/tnildispatcher.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/method/tnildispatcher.nim b/tests/method/tnildispatcher.nim
new file mode 100644
index 000000000..017e8155f
--- /dev/null
+++ b/tests/method/tnildispatcher.nim
@@ -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()