From 5aa486cf1172f7e34fa111a1c59c2add5e31bb35 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Sun, 9 Mar 2014 16:04:58 +0200 Subject: few more fixes for static params in macros; new failing test cases for static evaluation --- tests/vm/tstaticprintseq.nim | 48 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) (limited to 'tests/vm/tstaticprintseq.nim') 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) -- cgit 1.4.1-2-gfad0