@@ -52,9 +52,9 @@ val x = -10_000_000_000
5252```
5353gives 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
5959as 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```
198198Note 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
201201method in the `FromDigits` given instance . That method is defined in terms of a macro
202202implementation method `fromDigitsImpl`. Here is its definition :
@@ -220,7 +220,7 @@ implementation method `fromDigitsImpl`. Here is its definition:
220220```
221221The macro implementation takes an argument of type ` Expr[String] ` and yields
222222a 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
224224and lifts the resulting ` BigFloat ` back to ` Expr ` level. For non-constant
225225strings ` fromDigitsImpl(digits) ` is simply ` apply(digits) ` , i.e. everything is
226226evaluated at runtime in this case.
0 commit comments