Skip to content

Reject true && not true #3585

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mame
Copy link
Member

@mame mame commented Jun 13, 2025

A command-call-like not true must be rejected after && and ||.

https://bugs.ruby-lang.org/issues/21337

A command-call-like `not true` must be rejected after `&&` and `||`.

https://bugs.ruby-lang.org/issues/21337
true && not (true)
^ expected a `(` after `not`
^ unexpected '(', expecting end-of-input

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to add a test to confirm that

true && not
true

be rejected, but I am not sure how to write the test.


true && not (true)
^ expected a `(` after `not`
^ unexpected '(', expecting end-of-input
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message is a bit weird, but I am not sure how to fix it.

@mame mame requested a review from kddnewton June 13, 2025 07:47
@kddnewton
Copy link
Collaborator

This looks correct!! I can fix the error messages next Monday

@mame
Copy link
Member Author

mame commented Jun 24, 2025

@kddnewton Just a gentle follow-up on the PR I sent. I believe this fix is somewhat time-sensitive. Since the bug can lead to invalid Ruby code being written, it would be great to get it resolved before it spreads further. Ideally, it could also be backported to Ruby 3.4.5.

Please let me know if there's anything I can do to help move it forward. Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants