summary refs log tree commit diff stats
path: root/tests/varres/tvarres0.nim
blob: fd10a73bd3d10f54b1fc971b66fc9e01877e7a73 (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
discard """
  output: '''123
1234
123
1234
12345
'''
"""

# Test simple type
var a = 123
proc getA(): var int = a

echo getA()

getA() = 1234
echo getA()


# Test object type
type Foo = object
    a: int
var f: Foo
f.a = 123
proc getF(): var Foo = f
echo getF().a
getF().a = 1234
echo getF().a
getF() = Foo(a: 12345)
echo getF().a