Skip to content

Commit f1a26bd

Browse files
committed
Implement review suggestions
1 parent 24feac1 commit f1a26bd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ class Typer extends Namer
547547
inferImplicit(fromDigitsCls.typeRef.appliedTo(target), EmptyTree, tree.span) match {
548548
case SearchSuccess(arg, _, _) =>
549549
val fromDigits = untpd.Select(untpd.TypedSplice(arg), nme.fromDigits).withSpan(tree.span)
550-
val firstArg = Literal(Constant(digits.toString))
550+
val firstArg = Literal(Constant(digits))
551551
val otherArgs = tree.kind match {
552552
case Whole(r) if r != 10 => Literal(Constant(r)) :: Nil
553553
case _ => Nil

docs/docs/reference/changed-features/numeric-literals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: doc-page
33
title: Numeric Literals
44
---
55

6-
In Scala 2, numeric literals were confined to the promitive numeric types `Int`, Long`, `Float`, and `Double`. Scala 3 allows to write numeric literals also for user defined types. Example:
6+
In Scala 2, numeric literals were confined to the primitive numeric types `Int`, Long`, `Float`, and `Double`. Scala 3 allows to write numeric literals also for user defined types. Example:
77
```
88
val x: Long = -10_000_000_000
99
val y: BigInt = 0x123_abc_789_def_345_678_901
@@ -128,7 +128,7 @@ should produce the `BigFloat` number `BigFloat(-123, 997)`:
128128
The companion object of `BigFloat` defines an `apply` constructor method to construct a `BigFloat`
129129
from a `digits` string. Here is a possible implementation:
130130
```scala
131-
object BigFloat extends App {
131+
object BigFloat {
132132
import scala.util.FromDigits
133133

134134
def apply(digits: String): BigFloat = {
@@ -216,7 +216,7 @@ implementation method `fromDigitsImpl`. Here is its definition:
216216
case digits =>
217217
'{apply($digits)}
218218
}
219-
}
219+
} // end BigFloat
220220
```
221221
The macro implementation takes an argument of type `Expr[String]` and yields
222222
a result of type `Expr[BigFloat]`. It tests whether its argument is a constant

0 commit comments

Comments
 (0)