diff options
author | metagn <metagngn@gmail.com> | 2024-08-20 12:42:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-20 11:42:14 +0200 |
commit | 8bd0422767fbb0adb0080fe2bde0d6300ec038cc (patch) | |
tree | 15fc24a518031d8ed4a58741bec38a290a9340a4 | |
parent | 58813a3b2e375d91a307645168765372fb4584c8 (diff) | |
download | Nim-8bd0422767fbb0adb0080fe2bde0d6300ec038cc.tar.gz |
fix infinite recursion in term rewriting macros tests (#23979)
Noticed Hint [Pattern] spam in CI
-rw-r--r-- | tests/trmacros/tor.nim | 6 | ||||
-rw-r--r-- | tests/trmacros/trmacros_various2.nim | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/trmacros/tor.nim b/tests/trmacros/tor.nim index 6b4e71216..9defc4d1b 100644 --- a/tests/trmacros/tor.nim +++ b/tests/trmacros/tor.nim @@ -1,7 +1,7 @@ discard """ output: ''' 3 -0 +30 true ''' """ @@ -15,7 +15,9 @@ echo z template arithOps: untyped = (`+` | `-` | `*`) -template testOr{ (arithOps{f})(a, b) }(a, b, f: untyped): untyped = f(a mod 10, b) +template testOr{ (arithOps{f})(a, b) }(a, b, f: untyped): untyped = + {.noRewrite.}: + f(a mod 10, b) let xx = 10 echo 10*xx diff --git a/tests/trmacros/trmacros_various2.nim b/tests/trmacros/trmacros_various2.nim index 257ee8ba6..981df4ca6 100644 --- a/tests/trmacros/trmacros_various2.nim +++ b/tests/trmacros/trmacros_various2.nim @@ -70,7 +70,9 @@ block tstar: for i in 1..len(s)-1: result.add s[i] inc calls - template optConc{ `&&` * a }(a: string): string = &&a + template optConc{ `&&` * a }(a: string): string = + {.noRewrite.}: + &&a let space = " " echo "my" && (space & "awe" && "some " ) && "concat" |