parent
8bb1a6b041
commit
e68adca0c9
2 changed files with 26 additions and 2 deletions
25
tests/method/treturn_var_t.nim
Normal file
25
tests/method/treturn_var_t.nim
Normal file
|
|
@ -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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue