Skip to content

Correctly handle numeric separators with leading zeros #7440

@bishabosha

Description

@bishabosha

minimized code

val x = 0_1
val y = 0_00.1

... compiles fine

expectation

1 |val x = 0_1
  |        ^
  |Non-zero numbers may not have a leading zero.
1 |val y = 0_00.1
  |        ^
  |Non-zero numbers may not have a leading zero.

scala 2 does not allow the definition of y, dotty does, despite not allowing more than one leading zero for a non zero number.

Scala 2 is not opinionated about handling of x, but has no restrictions on leading zeros. Because dotty does not allow leading zeros for integers that are not zero, then separators should not change this behaviour

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions