diff options
author | Araq <rumpf_a@web.de> | 2015-09-06 02:32:39 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-09-06 02:32:39 +0200 |
commit | b1a55d83ec8e58bd0a66fe33dd8e82812b588cec (patch) | |
tree | f55f831c637a6e875ad2beb7a3aca2f9328a841c /tests/method | |
parent | dc047931bbde432512053c91d0cb9b8a230a7574 (diff) | |
download | Nim-b1a55d83ec8e58bd0a66fe33dd8e82812b588cec.tar.gz |
added missing test
Diffstat (limited to 'tests/method')
-rw-r--r-- | tests/method/tmapper.nim | 30 |
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() |