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

Bump Ruby checkout to 3.0 #400

Merged
merged 5 commits into from
Dec 31, 2022
Merged

Bump Ruby checkout to 3.0 #400

merged 5 commits into from
Dec 31, 2022

Conversation

reese
Copy link
Collaborator

@reese reese commented Dec 30, 2022

There are several new features in newer versions of Ruby that we should eventually add support for, so this is the first of several PRs to incrementally get the checkout up to date. I'll probably jump straight to 3.2 after this, but I had to make some revisions just to get 3.0 working so I figured I'd do them separately.

This will unblock much of the work on #399, with the rest unblocked once we get to 3.2.

(I also ran this over the Stripe codebase internally and it didn't seem to make any different changes from master and didn't crash, so I think this should be safe.)

else
escape_percent_array_paren_content(part, pattern)

unless delim.end_with?('[')
Copy link
Collaborator Author

@reese reese Dec 30, 2022

Choose a reason for hiding this comment

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

This change is due to ruby/ruby#3281, which moved tap from Object to Kernel in Ruby 3. In most cases that's fine, but since we're kinda hacking together Ruby bootstrapping here, Kernel hasn't been loaded yet, so tap doesn't exist. I also don't think we really needed it here, so I just removed it.

@@ -193,6 +194,7 @@ unsafe fn load_ripper() -> Result<(), ()> {
"../ruby_checkout/ext/ripper/lib/ripper/sexp.rb"
))?;

rb_gc_disable();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Totally open to suggestions on a better way to do this since I couldn't really figure out why GC.disable seemed to be undefined after I bumped to 3, but I ended up just calling the underlying VM implementation here instead to get ~the same result.

@@ -1 +1 @@
_1, (_2, _3) = []
_a, (_b, _c) = []
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Related to ruby/ruby#3163 -- in Ruby 3, assigning to numbered param is now a syntax error. This is technically a backwards-incompatible change for rubyfmt, but IMO I think that's fine.

@reese reese requested a review from fables-tales December 30, 2022 17:49
@reese reese merged commit fa8c56b into trunk Dec 31, 2022
@reese reese deleted the reese-ruby-3 branch December 31, 2022 19:41
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