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

Enable test variance-annotations-with-jsx with babel8 #14626

Merged
merged 1 commit into from Jun 5, 2022

Conversation

liuxingbaoyu
Copy link
Member

@liuxingbaoyu liuxingbaoyu commented May 31, 2022

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

@babel-bot
Copy link
Collaborator

babel-bot commented May 31, 2022

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

@liuxingbaoyu
Copy link
Member Author

liuxingbaoyu commented Jun 1, 2022

I'm having a weird problem here.
In parser tests, this file has a lot of redefinition errors.
But in the generator test, there is only one > error when parsing.

@nicolo-ribaudo
Copy link
Member

The generator test ignores all the recoverable errors when errorRecovery is enabled! I'm merging this, since it only touches tests.

@liuxingbaoyu
Copy link
Member Author

  "errors": [
    "SyntaxError: Unexpected token `>`. Did you mean `>` or `{'>'}`? (2:10)",
    "SyntaxError: 'public' modifier cannot appear on a type parameter. (98:9)",
    "SyntaxError: Duplicate modifier: 'in'. (99:16)",
    "SyntaxError: 'in' modifier must precede 'out' modifier. (99:16)",

Strangely, when I debug, only the first error is included in the parsing result.

@nicolo-ribaudo
Copy link
Member

Let me try cloning this PR locally 🤔

@nicolo-ribaudo
Copy link
Member

Is it in the Babel 7 or Babel 8 test?

@liuxingbaoyu
Copy link
Member Author

Thanks!

These bugs such as redefinition errors should exist in both babel 7 and 8.
https://github.com/babel/babel/blob/edd8d01bf26143ad648b61dda183f7986b8c5383/packages/babel-parser/test/fixtures/typescript/types/variance-annotations-with-jsx-babel-7/output.json
But errorRecovery is not needed in babel 7's generator tests.
Also only contains > symbol errors in babel 8's generator tests.
it's weird...

@nicolo-ribaudo
Copy link
Member

Uh well, you see different errors because the generator test and the parser tests have different inputs! The parser tests is londer and contain many invalid statements, so we test that we can still parse them.

For the generator we only care about printing them, and we only test valid inputs because invalid inputs are not 100% represented in the AST. For example, in in T has the same AST as in T so we only test the second one.

@liuxingbaoyu
Copy link
Member Author

Oh, thanks! I see, sorry for not noticing.

@nicolo-ribaudo nicolo-ribaudo merged commit 3b206e1 into babel:main Jun 5, 2022
@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 Sep 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: tests outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants