summary refs log tree commit diff stats
path: root/tests/method
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-09-06 02:32:39 +0200
committerAraq <rumpf_a@web.de>2015-09-06 02:32:39 +0200
commitb1a55d83ec8e58bd0a66fe33dd8e82812b588cec (patch)
treef55f831c637a6e875ad2beb7a3aca2f9328a841c /tests/method
parentdc047931bbde432512053c91d0cb9b8a230a7574 (diff)
downloadNim-b1a55d83ec8e58bd0a66fe33dd8e82812b588cec.tar.gz
added missing test
Diffstat (limited to 'tests/method')
-rw-r--r--tests/method/tmapper.nim30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/method/tmapper.nim b/tests/method/tmapper.nim
new file mode 100644
index 000000000..0008d9033
--- /dev/null
+++ b/tests/method/tmapper.nim
@@ -0,0 +1,30 @@
+discard """
+  errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tmapper.nim(22,7)"
+  line: 25
+"""
+
+# bug #2590
+
+type
+  Console* = ref object
+    mapper*: Mapper
+
+  Mapper* = ref object of RootObj
+
+  Mapper2* = ref object of Mapper
+
+proc newMapper2*: Mapper2 =
+  new result
+
+proc newMapper*: Mapper =
+  result = newMapper2()
+
+method step*(m: Mapper2) {.base.} =
+  echo "Mapper2"
+
+method step*(m: Mapper) {.base.} =
+  echo "Mapper"
+
+var console = Console()
+console.mapper = newMapper()
+console.mapper.step()