summary refs log tree commit diff stats
path: root/tests/js/t6612.nim
blob: 232711c1680b10ebff64b7b5dccd28fcc3126f36 (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
discard """
  action: "run"
"""

proc fillWith(sq: var seq[int], n: int, unused: string) =
  sq = @[n]

type
  Object = object of RootObj
    case hasNums: bool
    of true:
      numbers: seq[int]
    of false:
      discard
    always: seq[int]

var obj = Object(hasNums: true)

obj.always.fillWith(5, "unused")
doAssert obj.always == @[5]

obj.numbers.fillWith(3, "unused")
doAssert obj.numbers == @[3]
doAssert obj.always == @[5]