Skip to content

Disable generic numeric literals #10156

Closed
@bishabosha

Description

@bishabosha

Generic numeric literals should be under some sort of flag by 3.0 release.

Additionally, the scala.util.FromDigits classes should probably be moved to some experimental package or external library

Minimized code

this can be done in 3.0.0-M1 nightlies

case class FooNum(toInt: Int)

given util.FromDigits[FooNum]:
  def fromDigits(digits: String): FooNum = FooNum(BigInt(digits).toInt)

@main def Test =
  val foo: FooNum = 23
  println(foo)

Output

FooNum(23)

Expectation

should not compile without a flag

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions