blob: 4080a528653120d22bafe263ce4e6d744df7014c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
discard """
nimout: '''0
0
0
'''
"""
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"
assert otherTable == {"hallo": "123", "welt": "456"}.newTable
|