Skip to content

Accept 0x_42, reject 0x #8269

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

Merged
merged 1 commit into from
Feb 10, 2020
Merged

Accept 0x_42, reject 0x #8269

merged 1 commit into from
Feb 10, 2020

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Feb 10, 2020

Forward port fix on 2.11 for 0x.

2.13 accepts 0x_42 and was affirmed.

Also accept leading zero for decimals.
People like their literals to align left and right.
List(0000, 3.14) will harmonize vertically!

Leading zero is lintable in 2.13.

scala/scala@be553aa

Discussion affirming 0x_42 on scala/scala#8020 (a PR to fix caret position on error messages).

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

@som-snytt
Copy link
Contributor Author

More bad syntax tests could be unleashed in a follow-up.

It's nice that dotty corrects us with a caret and not a carrot:

scala> 0.7e-45f                                                                                                               
1 |0.7e-45f
  |^
  |number too small

scala> 2.0e-324                                                                                                               
1 |2.0e-324
  |^^^^^^^^
  |number too small

For some reason, float gets only one.

Forward port fix on 2.11 for `0x`.

2.13 accepts 0x_42 and was affirmed.

Also accept leading zero for decimals.
People like their literals to align left and right.
List(0000, 3.14) will harmonize vertically!

Leading zero is lintable in 2.13.
@odersky odersky merged commit 50ee303 into scala:master Feb 10, 2020
@som-snytt som-snytt deleted the issue/numbers branch February 10, 2020 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants