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

ruby27: Fix rescue parsing in multi assignement #3258

Merged
merged 1 commit into from
Jul 13, 2020

Conversation

Morriar
Copy link
Collaborator

@Morriar Morriar commented Jul 6, 2020

Motivation

As described in Ruby's change log, this PR changes how ruby27 parses the rescue modifier with multiple assignment to make it consistent with the singular form:

a = raise rescue 1
# => 1
a # => 1 in Ruby 2.6 and 2.7

a, b = raise rescue [1, 2]
# => [1, 2]

# 2.6
a # => nil
b # => nil
# The statement parsed as: (a, b = raise) rescue [1, 2]

# 2.7
a # => 1
b # => 2
# The statement parsed as: a, b = (raise rescue [1, 2])

This commit tracks upstream commit ruby/ruby@53b3be5.

Test plan

See included automated tests.

This commit tracks upstream commit ruby/ruby@53b3be5.

Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar requested a review from a team as a code owner July 6, 2020 15:53
@Morriar Morriar requested review from jez and removed request for a team July 6, 2020 15:53
Copy link
Collaborator

@jez jez left a comment

Choose a reason for hiding this comment

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

Thanks!

@jez jez merged commit d0e8d96 into sorbet:master Jul 13, 2020
@Morriar Morriar deleted the at-ruby27-rescue branch July 13, 2020 19:50
@Morriar Morriar mentioned this pull request Jul 15, 2020
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

2 participants