Repository navigation
Upgrade ruby-prism to 2.0, and parse Ruby 4.0's syntax - #88
Merged
Merged
Conversation
Dependabot's #85 raises ruby-prism to 2.0.0, which pks doesn't compile with: `Location` has `start` and `end` in place of `start_offset` and `end_offset`, and `Diagnostic::message` returns bytes. This takes the ruby-prism part of #85, so that Dependabot can rebase #85 onto just its dua-core and jsonschema updates. `message` no longer panics on a message that isn't UTF-8, so pks no longer catches that panic or quiets the panic hook while it does, and the unit test of the hook goes. pks still says "its message isn't UTF-8" for such a message. Without options, Prism 2.0 parses the syntax of Ruby 4.1, which isn't released until December 25. It accepts `&nil` and a trailing comma in a method's parameters, and rejects `break` in an `END` block, where Ruby 4.0 does the reverse. pks now asks Prism for Ruby 4.0's syntax (`Version::CRuby3_5`, as the crate names it), and a test checks all three. Prism 1.9 also defaulted to 4.1, but its 4.1 read these as 4.0 does, so pks reads them as it did before. The version will need raising once Ruby 4.1 is released. ruby-prism-sys 2.0 ships its bindings pregenerated, so a build no longer runs bindgen or needs libclang, and Cargo.lock loses ten packages, bindgen and clang-sys among them. INSTALLATION.md, the changelog and a comment in ci.yml now ask only for a C compiler. The lock has ruby-prism-sys 2.0.0, where #85 has 2.1.0, since 2.1.0 came out on October 28, inside Dependabot's 7-day cooldown.
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.
#85 fails to build because ruby-prism 2.0.0 changed its API. This takes the ruby-prism part of #85 and makes pks compile against it, so that Dependabot can rebase #85 onto just its dua-core and jsonschema updates, which build as they are.
API changes
Location::start_offset/end_offsetare nowstart/end, returningu32.Diagnostic::messagereturns&[u8]and no longer panics on a message that isn't UTF-8. pks no longer catches that panic or quiets the panic hook around it, and the unit test of the hook goes. pks still says "its message isn't UTF-8" for such a message, whichtest_check_warns_about_an_error_whose_message_isnt_utf_8covers.Parsing Ruby 4.0's syntax
With no options, Prism 2.0 parses the syntax of Ruby 4.1, which isn't released until December 25. Ruby 4.0, the newest release, disagrees with it on three constructs:
CRuby3_5(this PR)def a(&nil)def b(x,)END { break }So pks now parses with
Version::CRuby3_5, the crate's name for 4.0, andtest_check_reads_ruby_4_0_syntaxchecks all three with both parsers. WithVersion::Latestthat test fails. The version will need raising once 4.1 is released.No more libclang
ruby-prism-sys 2.0 ships its bindings pregenerated, so a build no longer runs bindgen, and Cargo.lock loses ten packages, bindgen and clang-sys among them. INSTALLATION.md, the Unreleased changelog and a comment in ci.yml now ask only for a C compiler.
The lock has ruby-prism-sys 2.0.0, where #85 has 2.1.0, since 2.1.0 came out on October 28, inside Dependabot's 7-day cooldown.
Testing
cargo test --locked: 398 pass.cargo clippy --all-targets --all-featuresandcargo fmt --checkare clean, andcargo auditpasses.tests/fixtures, withcheck,list-definitionsandlist-references, each with and without--experimental-parser. That was 216 runs, and the output was the same in all of them. The one fixture that panics,app_with_monkey_patcheswithout--experimental-parser, panics the same way on main: it's theTODOinconstant_resolver.rsabout two definitions of one constant.