Skip to content

Commit c1ba293

Browse files
committed
Apply documentation changes that were applied in the repo docs.scala-lang
Apply the changes that were applied in the repo scala/docs.scala-lang, since commit 113f485c10c9143d9a5f081974a87061903b5a0d within the tree `_scala3-reference`.
1 parent 6dc591a commit c1ba293

File tree

9 files changed

+11
-10
lines changed

9 files changed

+11
-10
lines changed

docs/_docs/reference/changed-features/pattern-matching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ A usage of a variadic extractor is irrefutable if one of the following condition
9494
## Boolean Match
9595

9696
- `U =:= Boolean`
97-
- Pattern-matching on exactly `0` pattern
97+
- Pattern-matching on exactly `0` patterns
9898

9999
For example:
100100

docs/_docs/reference/contextual/derivation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ given eqProduct[A](using inst: K0.ProductInstances[Eq, A]): Eq[A] with
330330
)
331331

332332
inline def derived[A](using gen: K0.Generic[A]): Eq[A] =
333-
gen.derive(eqSum, eqProduct)
333+
gen.derive(eqProduct, eqSum)
334334
```
335335

336336
The framework described here enables all three of these approaches without mandating any of them.

docs/_docs/reference/contextual/using-clauses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def maximum[T](xs: List[T])(using Ord[T]): T =
4343
xs.reduceLeft(max)
4444
```
4545

46-
`maximum` takes a context parameter of type `Ord` only to pass it on as an
46+
`maximum` takes a context parameter of type `Ord[T]` only to pass it on as an
4747
inferred argument to `max`. The name of the parameter is left out.
4848

4949
Generally, context parameters may be defined either as a full parameter list `(p_1: T_1, ..., p_n: T_n)` or just as a sequence of types `T_1, ..., T_n`. Vararg parameters are not supported in `using` clauses.

docs/_docs/reference/metaprogramming/staging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impose the following restrictions on the use of splices.
6060
The framework as discussed so far allows code to be staged, i.e. be prepared
6161
to be executed at a later stage. To run that code, there is another method
6262
in class `Expr` called `run`. Note that `$` and `run` both map from `Expr[T]`
63-
to `T` but only `$` is subject to the PCP, whereas `run` is just a normal method.
63+
to `T` but only `$` is subject to the [PCP](./macros.md#the-phase-consistency-principle), whereas `run` is just a normal method.
6464
`scala.quoted.staging.run` provides a `Quotes` that can be used to show the expression in its scope.
6565
On the other hand `scala.quoted.staging.withQuotes` provides a `Quotes` without evaluating the expression.
6666

docs/_docs/reference/new-types/match-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use of the match type as the return type):
6767
```scala
6868
def leafElem[X](x: X): LeafElem[X] = x match
6969
case x: String => x.charAt(0)
70-
case x: Array[t] => leafElem(x(9))
70+
case x: Array[t] => leafElem(x(0))
7171
case x: Iterable[t] => leafElem(x.head)
7272
case x: AnyVal => x
7373
```

docs/_docs/reference/new-types/union-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ scala> val name = UserName("Eve")
3232
val name: UserName = UserName(Eve)
3333

3434
scala> if true then name else password
35-
val res2: Object & Product = UserName(Eve)
35+
val res2: Object = UserName(Eve)
3636

3737
scala> val either: Password | UserName = if true then name else password
3838
val either: Password | UserName = UserName(Eve)

docs/_docs/reference/other-new-features/matchable.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ For instance, consider the definitions
119119

120120
```scala
121121
opaque type Meter = Double
122-
def Meter(x: Double) = x
122+
def Meter(x: Double): Meter = x
123123

124124
opaque type Second = Double
125-
def Second(x: Double) = x
125+
def Second(x: Double): Second = x
126126
```
127127

128128
Here, universal `equals` will return true for
@@ -134,6 +134,7 @@ Here, universal `equals` will return true for
134134
even though this is clearly false mathematically. With [multiversal equality](../contextual/multiversal-equality.md) one can mitigate that problem somewhat by turning
135135

136136
```scala
137+
import scala.language.strictEquality
137138
Meter(10) == Second(10)
138139
```
139140

docs/_docs/reference/other-new-features/transparent-traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ appear in the inferred type.
4242

4343
The traits [`scala.Product`](https://scala-lang.org/api/3.x/scala/Product.html), [`java.io.Serializable`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html) and [`java.lang.Comparable`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Comparable.html)
4444
are treated automatically as transparent. Other traits are turned into transparent traits using the modifier `transparent`. Scala 2 traits can also be made transparent
45-
by adding a [`@transparentTrait`](https://scala-lang.org/api/3.x/scala/annotation/transparentTrait.html) annotation. This annotation is defined in [`scala.annotation`](https://scala-lang.org/api/3.x/scala/annotation.html). It will be deprecated and phased out once Scala 2/3 interopability is no longer needed.
45+
by adding a [`@transparentTrait`](https://scala-lang.org/api/3.x/scala/annotation/transparentTrait.html) annotation. This annotation is defined in [`scala.annotation`](https://scala-lang.org/api/3.x/scala/annotation.html). It will be deprecated and phased out once Scala 2/3 interoperability is no longer needed.
4646

4747
Typically, transparent traits are traits
4848
that influence the implementation of inheriting classes and traits that are not usually used as types by themselves. Two examples from the standard collection library are:

docs/_docs/reference/syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ given if implicit import lazy match new
115115
null object override package private protected return
116116
sealed super then throw trait true try
117117
type val var while with yield
118-
: = <- => <: :> #
118+
: = <- => <: >: #
119119
@ =>> ?=>
120120
```
121121

0 commit comments

Comments
 (0)