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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: async(x?) should throw #13446

Closed
1 task done
tony-go opened this issue Jun 10, 2021 · 10 comments 路 Fixed by #13504
Closed
1 task done

[Bug]: async(x?) should throw #13446

tony-go opened this issue Jun 10, 2021 · 10 comments 路 Fixed by #13504
Assignees
Labels
area: flow area: typescript i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser

Comments

@tony-go
Copy link
Contributor

tony-go commented Jun 10, 2021

馃捇

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

async(x?) // it should throw

REPL

Configuration file name

No response

Configuration

No response

Current and expected behavior

Current: the input is parsed correctly

Expected: it should throw a Unexpected end of input (with the token position of course)

Environment

  • Babel version: 7.14.4
  • Electron: 1.8
  • Node: 10.3

Possible solution

No response

Additional context

No response

@babel-bot
Copy link
Collaborator

Hey @tony-go! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

@nicolo-ribaudo
Copy link
Member

We should also check that just (x?); throws.

@JLHwung
Copy link
Contributor

JLHwung commented Jun 10, 2021

For reference, Babel does not throw on unambiguous call expression when either flow or typescript plugin is enabled.

asyn(c?)

REPL.

@tony-go
Copy link
Contributor Author

tony-go commented Jun 18, 2021

Once #13419 is merged I switch to this one ^^

@tony-go
Copy link
Contributor Author

tony-go commented Jun 22, 2021

Hi @JLHwung and @nicolo-ribaudo 馃憢

It's a bit funny but is seems that on the version 7.14.5 it works 馃槅

I also check that it doesn't throw with typescript and flow. But I let you double check.

@tony-go
Copy link
Contributor Author

tony-go commented Jun 22, 2021

@JLHwung Maybe we fix it in our previous fix...

@nicolo-ribaudo
Copy link
Member

Well, it should throw when Flow or TS are enabled 馃槢

@JLHwung
Copy link
Contributor

JLHwung commented Jun 22, 2021

Can confirm it is fixed in #13419 . Because the checking logic was moved to checkExpressionErrors and we have already invoked checkExpressionErrors when parsing async call:

this.checkExpressionErrors(refExpressionErrors, true);

@nicolo-ribaudo
Copy link
Member

Oh we should still add a test then.

@tony-go
Copy link
Contributor Author

tony-go commented Jun 22, 2021

I'll add it so :)

@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 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: flow area: typescript i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants