Skip to content

Disable generic numeric literals #10156

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
bishabosha opened this issue Nov 3, 2020 · 1 comment
Closed

Disable generic numeric literals #10156

bishabosha opened this issue Nov 3, 2020 · 1 comment
Assignees
Labels
area:desugar Desugaring happens after parsing but before typing, see desugar.scala itype:bug prio:high stat:needs spec
Milestone

Comments

@bishabosha
Copy link
Member

bishabosha commented Nov 3, 2020

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

@nicolasstucki nicolasstucki added this to the 3.0.0 milestone Nov 4, 2020
@bishabosha bishabosha added area:desugar Desugaring happens after parsing but before typing, see desugar.scala prio:high stat:needs spec labels Nov 4, 2020
@odersky odersky self-assigned this Nov 9, 2020
@odersky
Copy link
Contributor

odersky commented Nov 17, 2020

Fixed by #10286

@odersky odersky closed this as completed Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:desugar Desugaring happens after parsing but before typing, see desugar.scala itype:bug prio:high stat:needs spec
Projects
None yet
Development

No branches or pull requests

3 participants