Skip to content
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

Prevent internal ruby failure on invalid braces #455

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

Conversation

reese
Copy link
Collaborator

@reese reese commented Jan 5, 2024

""} is invalid syntax, and while running it, Ripper tries to run on_embexpr_end to try and handle it as if it were the closing brace of an embexpr. However, in that case, we get a NoMethodError for trying to append to an array that isn't there (since we didn't call on_embexpr_beg. This is absolutely a weird edge case, but handling it means we correctly report this as a syntax error instead of an internal ruby error.

(There might be something to do here for a more sustainable solution, which is something like if we run into an internal ruby error, call the parser directly without rubyfmt_lib and see if it parses correctly, but I'll leave that as an idea for a later day.)

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.

None yet

1 participant