Skip to content

Commit 5e8e26f

Browse files
Merge pull request scala#7431 from dotty-staging/fix-doc-summonFrom
Fix summonFrom match from the documentation
2 parents 42e3ad4 + a8e18cd commit 5e8e26f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/docs/reference/metaprogramming/inline.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object Logger {
3333
The `Config` object contains a definition of the **inline value** `logging`.
3434
This means that `logging` is treated as a _constant value_, equivalent to its
3535
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).
3737
Used in this way, `inline` is equivalent to Java and Scala 2's `final`. Note that `final`, meaning
3838
_inlined constant_, is still supported in Dotty, but will be phased out.
3939

@@ -322,7 +322,7 @@ the singleton type `2`.
322322
So far we have seen inline methods that take terms (tuples and integers) as
323323
parameters. What if we want to base case distinctions on types instead? For
324324
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.
326326
We can already express this using rewrite match expressions and a simple
327327
helper function, `scala.compiletime.erasedValue`, which is defined as follows:
328328

@@ -362,9 +362,9 @@ Then:
362362
val dAny: None.type = defaultValue[Any]
363363
```
364364

365-
As another example, consider the type-level version of `toInt` below:
365+
As another example, consider the type-level version of `toInt` below:
366366
given a _type_ representing a Peano number,
367-
return the integer _value_ corresponding to it.
367+
return the integer _value_ corresponding to it.
368368
Consider the definitions of numbers as in the _Inline
369369
Match_ section above. Here is how `toIntT` can be defined:
370370

@@ -452,7 +452,7 @@ would use it as follows:
452452
```scala
453453
import scala.compiletime.summonFrom
454454

455-
inline def setFor[T]: Set[T] = summonFrom match {
455+
inline def setFor[T]: Set[T] = summonFrom {
456456
case given ord: Ordering[T] => new TreeSet[T]
457457
case _ => new HashSet[T]
458458
}

0 commit comments

Comments
 (0)