Skip to content

Numbers may not have a leading zero #8037

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

Closed
dvirf1 opened this issue Jan 19, 2020 · 0 comments
Closed

Numbers may not have a leading zero #8037

dvirf1 opened this issue Jan 19, 2020 · 0 comments

Comments

@dvirf1
Copy link
Contributor

dvirf1 commented Jan 19, 2020

While reading through the Scanner class I noticed that it emits an error when non-zero numbers have a leading zero.
e.g 1, 3.14 and 42d are valid literals, and 01, 03.14, 042d, 00042d are invalid, resulting in a compilation error:

Non-zero numbers may not have a leading zero.

This makes sense, and according to the main objectives of Scala 3 it is expected that this behavior will be consistent with zero numbers.
e.g 0, 0.0, 0d should be valid and 00, 00.0, 00d should be invalid.
When trying this in the REPL, this is already the behavior (which makes since because isDigit('0') yields true), and only the message ("non-zero numbers ..") is wrong.

liufengyun added a commit that referenced this issue Jan 20, 2020
fix #8037 Numbers may not have a leading zero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant