@@ -33,7 +33,7 @@ object Logger {
33
33
The ` Config ` object contains a definition of the ** inline value** ` logging ` .
34
34
This means that ` logging ` is treated as a _ constant value_ , equivalent to its
35
35
right-hand side ` false ` . The right-hand side of such an ` inline val ` must itself
36
- be a [ constant expression] ( https://scala-lang.org/files/archive/spec/2.12/06-expressions.html#constant-expressions ) .
36
+ be a [ constant expression] ( https://scala-lang.org/files/archive/spec/2.12/06-expressions.html#constant-expressions ) .
37
37
Used in this way, ` inline ` is equivalent to Java and Scala 2's ` final ` . Note that ` final ` , meaning
38
38
_ inlined constant_ , is still supported in Dotty, but will be phased out.
39
39
@@ -322,7 +322,7 @@ the singleton type `2`.
322
322
So far we have seen inline methods that take terms (tuples and integers) as
323
323
parameters. What if we want to base case distinctions on types instead? For
324
324
instance, one would like to be able to write a function ` defaultValue ` , that,
325
- given a type ` T ` , returns optionally the default value of ` T ` , if it exists.
325
+ given a type ` T ` , returns optionally the default value of ` T ` , if it exists.
326
326
We can already express this using rewrite match expressions and a simple
327
327
helper function, ` scala.compiletime.erasedValue ` , which is defined as follows:
328
328
@@ -362,9 +362,9 @@ Then:
362
362
val dAny : None .type = defaultValue[Any ]
363
363
```
364
364
365
- As another example, consider the type-level version of ` toInt ` below:
365
+ As another example, consider the type-level version of ` toInt ` below:
366
366
given a _ type_ representing a Peano number,
367
- return the integer _ value_ corresponding to it.
367
+ return the integer _ value_ corresponding to it.
368
368
Consider the definitions of numbers as in the _ Inline
369
369
Match_ section above. Here is how ` toIntT ` can be defined:
370
370
@@ -452,7 +452,7 @@ would use it as follows:
452
452
``` scala
453
453
import scala .compiletime .summonFrom
454
454
455
- inline def setFor [T ]: Set [T ] = summonFrom match {
455
+ inline def setFor [T ]: Set [T ] = summonFrom {
456
456
case given ord : Ordering [T ] => new TreeSet [T ]
457
457
case _ => new HashSet [T ]
458
458
}
0 commit comments