Repository navigation
Stop waiting for input after invalid bytes in a closed literal - #1278
Merged
Merged
Conversation
Prism 2.x reports `continuable? == true` when the only errors are invalid bytes in a finished literal, like `:"\xAE"` or `/\xAE/`. More input can not fix these errors, but IRB trusted the flag and waited for the next line forever. Treat the code as an unrecoverable error when every error is one of these invalid literal errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With Prism 2.x, IRB waits for more input after code like
:"\xAE"or/\xAE/. The user can not finish the expression, so IRB looks stuck. With this change, IRB evaluates the code and shows the error.Prism 2.x returns
continuable? == truewhen the only errors are invalid bytes in a finished literal (invalid_symbol,invalid_multibyte_escape,invalid_multibyte_character). More input can not fix these errors.check_code_syntaxnow returns:unrecoverable_errorwhen every error is one of them. If the literal is still open, like:"\xAE, IRB still waits for input.This also fixes the master CI failure on Ruby 2.7 to 3.2. CI started to resolve prism 2.1.0, and
test_evaluate_with_encoding_error_without_linenotimed out. That test only runs on Ruby < 3.3, so the new unit test checkscheck_code_syntaxdirectly on every Ruby.