summary refs log tree commit diff stats
path: root/tests/accept/run/tconstr2.nim
blob: 30cec5cb87bc8e746c2c0d2fb1845457dc79d3f2 (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
discard """
  file: "tconstr2.nim"
  output: "69"
"""
# Test array, record constructors

type
  TComplexRecord = tuple[
    s: string,
    x, y: int,
    z: float,
    chars: set[char]]

const
  things: array [0..1, TComplexRecord] = [
    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
    (s: "hi", x: 69, y: 45, z: 1.0, chars: {})] 
  otherThings = [  # the same
    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
    (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]

write(stdout, things[0].x)
#OUT 69