summary refs log tree commit diff stats
path: root/tests/accept/compile/trepr.nim
blob: b15081e489295871308fe9461640413e32d71443 (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
# test the new "repr" built-in proc

type
  TEnum = enum
    en1, en2, en3, en4, en5, en6

  TPoint {.final.} = object
    x, y, z: int
    s: array [0..1, string]
    e: TEnum

var
  p: TPoint
  q: ref TPoint
  s: seq[ref TPoint]

p.x = 0
p.y = 13
p.z = 45
p.s[0] = "abc"
p.s[1] = "xyz"
p.e = en6

new(q)
q[] = p

s = @[q, q, q, q]

writeln(stdout, repr(p))
writeln(stdout, repr(q))
writeln(stdout, repr(s))
writeln(stdout, repr(en4))