-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const folding happens too early in semantic phase so it's invisible to term rewriting macros and astToStr #9301
Comments
For the TR macros that's not a bug, TR macros are not about random rewritings, they are about optmizations and what has been reduced by the compiler doesn't require further optimization. |
after #9332 , |
well I was hoping it could be useful for "random rewritings" as you said (with caveat that any tool can be misused); a number of use cases come to mind, notably for debugging, eg warning when a certain pattern is found during compilation |
… refs nim-lang#9301 (nim-lang#9332) * fixes nim-lang#8518; refs nim-lang#9301; correctly render AST in doAssert condition
… refs nim-lang#9301 (nim-lang#9332) * fixes nim-lang#8518; refs nim-lang#9301; correctly render AST in doAssert condition
… refs nim-lang#9301 (nim-lang#9332) * fixes nim-lang#8518; refs nim-lang#9301; correctly render AST in doAssert condition
note:
for the TRM case, this is the root cause of what was observed by @kaushalmodi in https://scripter.co/notes/nim/#term-rewriting-macros "echo "Calculating 3 * 2:" # Why isn't term rewriting activated here?"
note:
in particular it affects doAssert:
doAssert a == 2
will just showfalse failed
as the expression obtained from astToStr instead of the more informativea == 2 failed
The text was updated successfully, but these errors were encountered: