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

Error "Identifier directly after number" when using "_" as number separator #5407

Closed
MarkTanashchuk opened this issue Sep 16, 2020 · 5 comments · Fixed by #5423
Closed

Error "Identifier directly after number" when using "_" as number separator #5407

MarkTanashchuk opened this issue Sep 16, 2020 · 5 comments · Fixed by #5423
Labels
feature request good first issue A small, encapsulated issue, ideal for a new contributor to Svelte to tackle.

Comments

@MarkTanashchuk
Copy link

MarkTanashchuk commented Sep 16, 2020

In JS you can use _ as a number separator.

However, I recently noticed that Svelte displays an error Identifier directly after number when i use _ in numbers

https://svelte.dev/repl/6612cec5c50b44cbab7f4a64ff930153?version=3.25.1

This feature is definitely useful, so it would be nice to fix this bug.

@MarkTanashchuk MarkTanashchuk changed the title Error "Identifier directly after number" when using "_" as the number separator Error "Identifier directly after number" when using "_" as number separator Sep 16, 2020
@MarkTanashchuk MarkTanashchuk changed the title Error "Identifier directly after number" when using "_" as number separator Error Identifier directly after number when using _ as number separator Sep 16, 2020
@MarkTanashchuk MarkTanashchuk changed the title Error Identifier directly after number when using _ as number separator Error "Identifier directly after number" when using "_" as number separator Sep 16, 2020
@antony
Copy link
Member

antony commented Sep 16, 2020

I'm hesitant to call it a bug, Svelte is a language/DSL so it's more of an unsupported language feature.

I will agree that it's desirable however, and I think it might be an easy solve, so I'm marking it as a good first issue.

@antony antony added the good first issue A small, encapsulated issue, ideal for a new contributor to Svelte to tackle. label Sep 16, 2020
@Conduitry
Copy link
Member

I'm hoping this would just be a matter of updating Acorn. It looks like ours is out of date.

@Conduitry
Copy link
Member

Yep, Acorn's changelog says they were added in 7.4.0, and we're using 7.3.1. We should still update to 8.x though, and that will likely involve bumping the dependency in code-red.

@Conduitry
Copy link
Member

You can now do this in 3.26.0 - https://svelte.dev/repl/6612cec5c50b44cbab7f4a64ff930153?version=3.26.0

@MarkTanashchuk
Copy link
Author

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request good first issue A small, encapsulated issue, ideal for a new contributor to Svelte to tackle.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants