diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-05-28 22:00:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-28 22:00:01 +0200 |
commit | e68adca0c971d911e484a81effc516afc0287bae (patch) | |
tree | dd9bfbd9adc80cc15c97d488e14d8c5a5997bd93 /tests | |
parent | 8bb1a6b04189b6c0f7438ac1b1c17099789f2bd6 (diff) | |
download | Nim-e68adca0c971d911e484a81effc516afc0287bae.tar.gz |
fixes #6777 (#11347)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/method/treturn_var_t.nim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/method/treturn_var_t.nim b/tests/method/treturn_var_t.nim new file mode 100644 index 000000000..91d982902 --- /dev/null +++ b/tests/method/treturn_var_t.nim @@ -0,0 +1,25 @@ +discard """ + output: '''Inh +45''' +""" + +type + Base = ref object of RootObj + field: int + + Inh = ref object of Base + +# bug #6777 +method foo(b: Base): var int {.base.} = + echo "Base" + result = b.field + +method foo(b: Inh): var int = + echo "Inh" + result = b.field + +var x: Base +var y = Inh(field: 45) +x = y +echo foo(x) + |