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

Incorrect multiline enum parsing #42822

Closed
fedeci opened this issue Feb 16, 2021 · 2 comments
Closed

Incorrect multiline enum parsing #42822

fedeci opened this issue Feb 16, 2021 · 2 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@fedeci
Copy link

fedeci commented Feb 16, 2021

Bug Report

πŸ”Ž Search Terms

  • multiline enum
  • line break enum
  • enum parsing

πŸ•— Version & Regression Information

I don't think this is a regression.

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

enum
E 
{
  foo,
  bar
}
enum
F {
  foo,
  bar
}

πŸ™ Actual behavior

These declarations are parsed as valid enum declarations.

πŸ™‚ Expected behavior

enum declarations containing a line break between the enum keyword and the identifier should be parsed as multiple expressions.

- EnumDeclaration
+ ExpressionStatement: Identifier: enum
+ ExpressionStatement: Identifier: E
+ Block

Linked issues

babel/babel#12773, babel/babel#12776
Also consider: babel/babel#12776 (comment)
/cc @armano2 @JLHwung @nicolo-ribaudo

@nicolo-ribaudo
Copy link

nicolo-ribaudo commented Feb 16, 2021

Note that I don't think that this is a bug: enum is a reserved word (and not a valid identifier), so there is no ambiguity allowing a line terminator.

(this issue was probably opened in response to babel/babel#12776 (comment)).

@DanielRosenwasser
Copy link
Member

Correct, this is working as intended.

@DanielRosenwasser DanielRosenwasser added the Working as Intended The behavior described is the intended behavior; this is not a bug label Feb 16, 2021
@fedeci fedeci closed this as completed Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants