fixes #798
This commit is contained in:
parent
5d6053173a
commit
7c065bfadf
12 changed files with 10 additions and 2 deletions
19
tests/trmacros/tstar.nim
Normal file
19
tests/trmacros/tstar.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
discard """
|
||||
output: "my awesome concat"
|
||||
"""
|
||||
|
||||
var
|
||||
calls = 0
|
||||
|
||||
proc `&&`(s: varargs[string]): string =
|
||||
result = s[0]
|
||||
for i in 1..len(s)-1: result.add s[i]
|
||||
inc calls
|
||||
|
||||
template optConc{ `&&` * a }(a: string): expr = &&a
|
||||
|
||||
let space = " "
|
||||
echo "my" && (space & "awe" && "some " ) && "concat"
|
||||
|
||||
# check that it's been optimized properly:
|
||||
doAssert calls == 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue