diff options
Diffstat (limited to 'tests/vm/tstaticprintseq.nim')
-rw-r--r-- | tests/vm/tstaticprintseq.nim | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/tests/vm/tstaticprintseq.nim b/tests/vm/tstaticprintseq.nim index 99a56d161..f7ed1e2bb 100644 --- a/tests/vm/tstaticprintseq.nim +++ b/tests/vm/tstaticprintseq.nim @@ -4,18 +4,52 @@ discard """ 3 1 2 +3 +1 +2 +3 +1 +2 3''' """ -const s = @[1,2,3] +when false: + const s = @[1,2,3] + + macro foo: stmt = + for e in s: + echo e -macro foo: stmt = - for e in s: - echo e + foo() -foo() + static: + for e in s: + echo e + + macro bar(x: static[seq[int]]): stmt = + for e in x: + echo e + + bar s + bar(@[1, 2, 3]) + +type + TData = tuple + letters: seq[string] + numbers: seq[int] + +const data: TData = (@["aa", "bb"], @[11, 22]) static: - for e in s: - echo e + for x in data.letters: + echo x + + var m = data + for x in m.letters: + echo x + +macro ff(d: static[TData]): stmt = + for x in d.letters: + echo x +ff(data) |