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 invalid setter parse #12076

Merged
merged 2 commits into from Sep 19, 2020
Merged

Fix invalid setter parse #12076

merged 2 commits into from Sep 19, 2020

Conversation

fisker
Copy link
Contributor

@fisker fisker commented Sep 18, 2020

Q                       A
Fixed Issues? Fixes #12074
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes? No
License MIT

I'm new to this codebase, not sure is this enough. If I'm missing anything, just let me know.

Found another similar code here, not sure if it has similar issue, and not sure how to test it.

@babel-bot
Copy link
Collaborator

babel-bot commented Sep 18, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/28556/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 18, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8a15677:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

"type": "File",
"start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}},
"errors": [
"SyntaxError: setter must have exactly one formal parameter (1:3)"
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated, but I think we can improve this error message:

A setter must have exactly one parameter.

Or Typescript's:

A 'set' accessor must have exactly one parameter.

@existentialism existentialism added pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Sep 18, 2020
@nicolo-ribaudo
Copy link
Member

@fisker That similar code is used when producing an ESTree-compliant AST. You can test it enabling the "estree" parser plugin (example: packages/babel-parser/test/fixtures/estree/options.json)

@fisker
Copy link
Contributor Author

fisker commented Sep 18, 2020

@nicolo-ribaudo Thanks for this guidance, but I'm not near the laptop I used to make this PR, and I don't want setup environment on another computer, it took me a while to make it run.

Can you help me test/fix it?

@existentialism
Copy link
Member

@fisker I got you

@fisker
Copy link
Contributor Author

fisker commented Sep 18, 2020

Thank you!

@fisker
Copy link
Contributor Author

fisker commented Sep 18, 2020

I wonder if this part can use the new logic?

@existentialism
Copy link
Member

@fisker I'd say we can do that in a follow-up, as it requires more breaking things up (FunctionTypeAnnotation don't have the rest element inside params).

@fisker
Copy link
Contributor Author

fisker commented Sep 18, 2020

Okay, thank you very much.

@nicolo-ribaudo nicolo-ribaudo merged commit 18d13d0 into babel:main Sep 19, 2020
@fisker fisker deleted the fix-invalid-setter branch September 19, 2020 10:55
sosukesuzuki added a commit to sosukesuzuki/prettier that referenced this pull request Oct 15, 2020
sosukesuzuki added a commit to sosukesuzuki/prettier that referenced this pull request Oct 15, 2020
sosukesuzuki added a commit to prettier/prettier that referenced this pull request Oct 20, 2020
* Install babel/parser 7.12

* Add tests for babel/babel#12161

* Add test for babel/babel#12076

* Add test for babel/babel#12085

* Add test for babel/babel#12108

* Add test for babel/babel#12120

* Add test for babel/babel#12054

* Add test for babel/babel#12061

* Add test babel/babel#12093

* Add test for babel/babel#12065

* Add test for babel/babel#12111

* Add test for babel/babel#12072

* Switch syntax-module-attributes to syntax-import-assertion

* Support "String import/export specifier"

* Remove tests for module-attributes

* Add changelog

* Update to 7.12.3

* Fix by linter

* Fix by spellchecker

* Add tests for module attributes to errors

* Add error test for module string name with import

* Remove TSTypeCastExpression

* Add tests for funny import-assertions

* Update snapshots|

* Add more tests
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 20, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parser fail on errorRecovery mode
5 participants