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

Fix parsing context for lambdas and modules #3363

Merged
merged 1 commit into from Sep 10, 2020

Conversation

Morriar
Copy link
Collaborator

@Morriar Morriar commented Aug 13, 2020

Motivation

This pull-request fixes the context used when entering classes, modules and lambdas (port of whitequark/parser#709).

This fixes a bug where the parser rejected valid code:

class A; ->(a = (return; 1)) {}; end
#                ^^^^^^ error: invalid return in class/module body

Which is now correctly parsed.

Test plan

See included automated tests.

@Morriar Morriar requested a review from a team as a code owner August 13, 2020 18:42
@Morriar Morriar requested review from DarkDimius and removed request for a team August 13, 2020 18:42
@Morriar Morriar changed the title Fix parsing context for lambda and modules Fix parsing context for lambdas and modules Aug 13, 2020
@Morriar Morriar mentioned this pull request Aug 13, 2020
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
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.

This mostly looks good to me. I'm happy to merge after you have a chance to answer my questions.

@Morriar
Copy link
Collaborator Author

Morriar commented Sep 10, 2020

Let's merge this one as this and complete the work in #3344.

@jez jez merged commit 0e0bad3 into sorbet:master Sep 10, 2020
@Morriar Morriar deleted the at-fix-parser-context branch September 10, 2020 22:03
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