mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 10:22:15 +00:00
* fix term rewriting with sideeffect fix #6217 * add tests * Update tests/template/template_various.nim
20 lines
233 B
Nim
20 lines
233 B
Nim
discard """
|
|
output: '''
|
|
start
|
|
side effect!
|
|
end
|
|
'''
|
|
"""
|
|
|
|
# bug #6217
|
|
|
|
template optMul{`*`(a, 2)}(a: int{noSideEffect}): int = a+a
|
|
|
|
proc f(): int =
|
|
echo "side effect!"
|
|
result = 55
|
|
|
|
echo "start"
|
|
doAssert f() * 2 == 110
|
|
echo "end"
|