Skip to content

Commit 3fd3505

Browse files
committed
doc(numeric-literals): polishing format
1 parent 28ad887 commit 3fd3505

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ val x = -10_000_000_000
5252
```
5353
gives a type error, since without an expected type `-10_000_000_000` is treated by rule (3) as an `Int` literal, but it is too large for that type.
5454

55-
### The FromDigits Class
55+
### The FromDigits Trait
5656

57-
To allow numeric literals, a type simply has to define a given instance of the
57+
To allow numeric literals, a type simply has to define a `given` instance of the
5858
`scala.util.FromDigits` typeclass, or one of its subclasses. `FromDigits` is defined
5959
as follows:
6060
```scala
@@ -153,7 +153,7 @@ object BigFloat {
153153
BigFloat(BigInt(intPart), exponent)
154154
}
155155
```
156-
To accept `BigFloat` literals, all that's needed in addition is a given instance of type
156+
To accept `BigFloat` literals, all that's needed in addition is a `given` instance of type
157157
`FromDigits.Floating[BigFloat]`:
158158
```scala
159159
given FromDigits as FromDigits.Floating[BigFloat] {
@@ -196,7 +196,7 @@ object BigFloat {
196196
}
197197
```
198198
Note that an inline method cannot directly fill in for an abstract method, since it produces
199-
no code that can be executed at runtime. That's why we define an intermediary class
199+
no code that can be executed at runtime. That is why we define an intermediary class
200200
`FromDigits` that contains a fallback implementation which is then overridden by the inline
201201
method in the `FromDigits` given instance. That method is defined in terms of a macro
202202
implementation method `fromDigitsImpl`. Here is its definition:
@@ -220,7 +220,7 @@ implementation method `fromDigitsImpl`. Here is its definition:
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
223-
string. If that's the case, it converts the string using the `apply` method
223+
string. If that is the case, it converts the string using the `apply` method
224224
and lifts the resulting `BigFloat` back to `Expr` level. For non-constant
225225
strings `fromDigitsImpl(digits)` is simply `apply(digits)`, i.e. everything is
226226
evaluated at runtime in this case.

0 commit comments

Comments
 (0)