Skip to content

Commit c45b7c9

Browse files
committed
More doc pages updates
1 parent 280f094 commit c45b7c9

25 files changed

+64
-64
lines changed

docs/docs/internals/explicit-nulls.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ The reason for casting to `x.type & T`, as opposed to just `T`, is that it allow
111111
support flow typing for paths of length greater than one.
112112

113113
```scala
114-
abstract class Node:
114+
abstract class Node with
115115
val x: String
116116
val next: Node | Null
117117

docs/docs/reference/changed-features/implicit-resolution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ no longer applies.
4444

4545
given a: A = A()
4646

47-
object o:
47+
object o with
4848
given b: B = B()
4949
type C
5050
```

docs/docs/reference/changed-features/numeric-literals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ whole numbers with a given radix, for numbers with a decimal point, and for
8686
numbers that can have both a decimal point and an exponent:
8787

8888
```scala
89-
object FromDigits:
89+
object FromDigits with
9090

9191
/** A subclass of `FromDigits` that also allows to convert whole
9292
* number literals with a radix other than 10
@@ -203,7 +203,7 @@ into a macro, i.e. make it an inline method with a splice as right-hand side.
203203
To do this, replace the `FromDigits` instance in the `BigFloat` object by the following two definitions:
204204

205205
```scala
206-
object BigFloat:
206+
object BigFloat with
207207
...
208208

209209
class FromDigits extends FromDigits.Floating[BigFloat] with

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ For example:
100100
<!-- To be kept in sync with tests/new/patmat-spec.scala -->
101101

102102
```scala
103-
object Even:
103+
object Even with
104104
def unapply(s: String): Boolean = s.size % 2 == 0
105105

106106
"even" match
@@ -130,7 +130,7 @@ class FirstChars(s: String) extends Product with
130130
def productArity: Int = ???
131131
def productElement(n: Int): Any = ???
132132

133-
object FirstChars:
133+
object FirstChars with
134134
def unapply(s: String): FirstChars = new FirstChars(s)
135135

136136
"Hi!" match
@@ -151,7 +151,7 @@ class Nat(val x: Int) with
151151
def get: Int = x
152152
def isEmpty = x < 0
153153

154-
object Nat:
154+
object Nat with
155155
def unapply(x: Int): Nat = new Nat(x)
156156

157157
5 match
@@ -167,7 +167,7 @@ object Nat:
167167
- Pattern-matching on exactly `N` patterns with types `P1, P2, ..., PN`
168168

169169
```Scala
170-
object ProdEmpty:
170+
object ProdEmpty with
171171
def _1: Int = ???
172172
def _2: String = ???
173173
def isEmpty = true
@@ -199,7 +199,7 @@ type X = {
199199
<!-- To be kept in sync with tests/new/patmat-spec.scala -->
200200

201201
```scala
202-
object CharList:
202+
object CharList with
203203
def unapplySeq(s: String): Option[Seq[Char]] = Some(s.toList)
204204

205205
"example" match
@@ -221,7 +221,7 @@ object CharList:
221221

222222
```Scala
223223
class Foo(val name: String, val children: Int *)
224-
object Foo:
224+
object Foo with
225225
def unapplySeq(f: Foo): Option[(String, Seq[Int])] =
226226
Some((f.name, f.children))
227227

docs/docs/reference/changed-features/structural-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ defines the necessary `selectDynamic` member.
152152
`Vehicle` could also extend some other subclass of `scala.Selectable` that implements `selectDynamic` and `applyDynamic` differently. But if it does not extend a `Selectable` at all, the code would no longer typecheck:
153153

154154
```scala
155-
trait Vehicle:
155+
trait Vehicle with
156156
val wheels: Int
157157

158158
val i3 = new Vehicle: // i3: Vehicle

docs/docs/reference/contextual/context-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ With that setup, the table construction code above compiles and expands to:
116116
As a larger example, here is a way to define constructs for checking arbitrary postconditions using an extension method `ensuring` so that the checked result can be referred to simply by `result`. The example combines opaque type aliases, context function types, and extension methods to provide a zero-overhead abstraction.
117117

118118
```scala
119-
object PostConditions:
119+
object PostConditions with
120120
opaque type WrappedResult[T] = T
121121

122122
def result[T](using r: WrappedResult[T]): T = r

docs/docs/reference/contextual/derivation-macro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ import scala.quoted._
142142
trait Eq[T]:
143143
def eqv(x: T, y: T): Boolean
144144

145-
object Eq:
145+
object Eq with
146146
given Eq[String] with
147147
def eqv(x: String, y: String) = x == y
148148

@@ -195,7 +195,7 @@ object Eq:
195195
end derived
196196
end Eq
197197

198-
object Macro3:
198+
object Macro3 with
199199
extension [T](inline x: T)
200200
inline def === (inline y: T)(using eq: Eq[T]): Boolean = eq.eqv(x, y)
201201

docs/docs/reference/contextual/derivation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ They also provide minimal term level infrastructure to allow higher level librar
4040
derivation support.
4141

4242
```scala
43-
sealed trait Mirror:
43+
sealed trait Mirror with
4444

4545
/** the type being mirrored */
4646
type MirroredType
@@ -57,7 +57,7 @@ sealed trait Mirror:
5757
/** The names of the elements of the type */
5858
type MirroredElemLabels <: Tuple
5959

60-
object Mirror:
60+
object Mirror with
6161

6262
/** The Mirror for a product type */
6363
trait Product extends Mirror:
@@ -242,7 +242,7 @@ inline def summonAll[T <: Tuple]: List[Eq[_]] =
242242
trait Eq[T]:
243243
def eqv(x: T, y: T): Boolean
244244

245-
object Eq:
245+
object Eq with
246246
given Eq[Int] with
247247
def eqv(x: Int, y: Int) = x == y
248248

docs/docs/reference/contextual/given-imports.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ title: "Importing Givens"
66
A special form of import wildcard selector is used to import given instances. Example:
77

88
```scala
9-
object A:
9+
object A with
1010
class TC
1111
given tc: TC = ???
1212
def f(using TC) = ???
1313

14-
object B:
14+
object B with
1515
import A._
1616
import A.given
1717
...
@@ -22,7 +22,7 @@ of `A` _except_ the given instance `tc`. Conversely, the second import `import A
2222
The two import clauses can also be merged into one:
2323

2424
```scala
25-
object B:
25+
object B with
2626
import A.{given, _}
2727
...
2828
```
@@ -58,7 +58,7 @@ Importing all given instances of a parameterized type is expressed by wildcard a
5858
For instance, assuming the object
5959

6060
```scala
61-
object Instances:
61+
object Instances with
6262
given intOrd: Ordering[Int] = ...
6363
given listOrd[T: Ordering]: Ordering[List[T]] = ...
6464
given ec: ExecutionContext = ...

docs/docs/reference/contextual/multiversal-equality.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import annotation.implicitNotFound
5454
@implicitNotFound("Values of types ${L} and ${R} cannot be compared with == or !=")
5555
sealed trait CanEqual[-L, -R]
5656

57-
object CanEqual:
57+
object CanEqual with
5858
object derived extends CanEqual[Any, Any]
5959
```
6060

0 commit comments

Comments
 (0)