diff options
author | Araq <rumpf_a@web.de> | 2014-07-08 02:02:58 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-07-08 02:02:58 +0200 |
commit | f16449ec22751ca0e864d70424760e540a80c804 (patch) | |
tree | a6dc81d9b0ae81d925345e64b4d32ec611ac8d22 /tests/macros | |
parent | f9d7e8db2a8b89575df51768ce9e5aa66c47cc9f (diff) | |
download | Nim-f16449ec22751ca0e864d70424760e540a80c804.tar.gz |
fixes #1103; fixes #1297
Diffstat (limited to 'tests/macros')
-rw-r--r-- | tests/macros/tbug1149.nim | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/tests/macros/tbug1149.nim b/tests/macros/tbug1149.nim index 5c4cb8530..d2bff61d3 100644 --- a/tests/macros/tbug1149.nim +++ b/tests/macros/tbug1149.nim @@ -2,7 +2,13 @@ discard """ msg: '''a s d -f''' +f +TTaa +TTaa +TTaa +TTaa''' + +output: '''test''' """ type @@ -18,3 +24,41 @@ macro test(): stmt = echo i.s test() + + +# bug 1297 + +import macros + +type TType = tuple[s: string] + +macro echotest(): stmt = + var t: TType + t.s = "" + t.s.add("test") + result = newCall(newIdentNode("echo"), newStrLitNode(t.s)) + +echotest() + +# bug #1103 + +type + Td = tuple + a:string + b:int + +proc get_data(d: Td) : string {.compileTime.} = + result = d.a # Works if a literal string is used here. + # Bugs if line A or B is active. Works with C + result &= "aa" # A + #result.add("aa") # B + #result = result & "aa" # C + +macro m(s:static[Td]) : stmt = + echo get_data(s) + echo get_data(s) + result = newEmptyNode() + +const s=("TT", 3) +m(s) +m(s) |