-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
refs #17292 fix repr: (discard) now does't render as discard which gave illegal code
#17455
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
refs #17292 fix repr: (discard) now does't render as discard which gave illegal code
#17455
Conversation
70168c6 to
5c12f68
Compare
|
Hardly acceptable. Special case, what about an empty |
|
these work as you'd expect after this PR: macro deb(a) =
echo a.repr
deb:
block:
discard
discard
block:
when true: discard
# let a = b => discard # illegal
let a = b => (discard) # legal but, before this PR, repr rendered it incorrectly
block:
returnunless you can find an example that gets worse after this PR, I think this is a useful bugfix. |
|
Why does block:
discardnot produce the |
5c12f68 to
959572f
Compare
|
PTAL
because:
the PR does the correct thing in both cases. I've added more tests. |
eb0f803 to
0a27db1
Compare
0a27db1 to
c88d69a
Compare
|
@Araq ping on this |
|
Still reviewing it -- it's adhoc and as I said, who knows if |
I can't find any case involving return, break, raise where repr gives incorrect results, and I can't find a case that would break as a result of this PR. This PR fixes a known bug, if we later find another bug, it can always be fixed then. |
…card` which gave illegal code (nim-lang#17455) * refs nim-lang#17292 fix `repr` with (discard) * add tests * add more tests
refs #17292
now renders as:
instead of this:
which is illegal (it was making runnableExamples invalid prior to #17282, but the underlying bug remained and affected things like parseExpr, parseStmt, or operations based on renderModule)