fixes #5327
This commit is contained in:
parent
4ac6a26031
commit
26fb6cb073
3 changed files with 45 additions and 6 deletions
38
tests/vm/tableinstatic.nim
Normal file
38
tests/vm/tableinstatic.nim
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
discard """
|
||||
nimout: '''0
|
||||
0
|
||||
0
|
||||
{hallo: 123, welt: 456}'''
|
||||
"""
|
||||
|
||||
import tables
|
||||
|
||||
# bug #5327
|
||||
|
||||
type
|
||||
MyType* = object
|
||||
counter: int
|
||||
|
||||
proc foo(t: var MyType) =
|
||||
echo t.counter
|
||||
|
||||
proc bar(t: MyType) =
|
||||
echo t.counter
|
||||
|
||||
static:
|
||||
var myValue: MyType
|
||||
myValue.foo # works nicely
|
||||
|
||||
var refValue: ref MyType
|
||||
refValue.new
|
||||
|
||||
refValue[].foo # fails to compile
|
||||
refValue[].bar # works again nicely
|
||||
|
||||
static:
|
||||
var otherTable = newTable[string, string]()
|
||||
|
||||
otherTable["hallo"] = "123"
|
||||
otherTable["welt"] = "456"
|
||||
|
||||
echo otherTable
|
||||
Loading…
Add table
Add a link
Reference in a new issue