@@ -52,9 +52,9 @@ val x = -10_000_000_000
52
52
```
53
53
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.
54
54
55
- ### The FromDigits Class
55
+ ### The FromDigits Trait
56
56
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
58
58
` scala.util.FromDigits ` typeclass, or one of its subclasses. ` FromDigits ` is defined
59
59
as follows:
60
60
``` scala
@@ -153,7 +153,7 @@ object BigFloat {
153
153
BigFloat (BigInt (intPart), exponent)
154
154
}
155
155
```
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
157
157
`FromDigits.Floating[BigFloat]`:
158
158
```scala
159
159
given FromDigits as FromDigits .Floating [BigFloat ] {
@@ -196,7 +196,7 @@ object BigFloat {
196
196
}
197
197
```
198
198
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
200
200
`FromDigits` that contains a fallback implementation which is then overridden by the inline
201
201
method in the `FromDigits` given instance . That method is defined in terms of a macro
202
202
implementation method `fromDigitsImpl`. Here is its definition :
@@ -220,7 +220,7 @@ implementation method `fromDigitsImpl`. Here is its definition:
220
220
```
221
221
The macro implementation takes an argument of type ` Expr[String] ` and yields
222
222
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
224
224
and lifts the resulting ` BigFloat ` back to ` Expr ` level. For non-constant
225
225
strings ` fromDigitsImpl(digits) ` is simply ` apply(digits) ` , i.e. everything is
226
226
evaluated at runtime in this case.
0 commit comments