Skip to content

Commit be710fa

Browse files
committed
Change new ... with to new ... :
`new ... with` is currently under discussion, but not supported.
1 parent eb74f7d commit be710fa

File tree

9 files changed

+27
-27
lines changed

9 files changed

+27
-27
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ the context parameters `xi`.
4343
The context function literal is evaluated as the instance creation
4444
expression
4545
```scala
46-
new scala.ContextFunctionN[T1, ..., Tn, T] with
46+
new scala.ContextFunctionN[T1, ..., Tn, T]:
4747
def apply(using x1: T1, ..., xn: Tn): T = e
4848
```
4949
A context parameter may also be a wildcard represented by an underscore `_`. In that case, a fresh name for the parameter is chosen arbitrarily.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ object Eq:
150150
def eqv(x: Int, y: Int) = x == y
151151

152152
def eqProduct[T](body: (T, T) => Boolean): Eq[T] =
153-
new Eq[T] with
153+
new Eq[T]:
154154
def eqv(x: T, y: T): Boolean = body(x, y)
155155

156156
def eqSum[T](body: (T, T) => Boolean): Eq[T] =
157-
new Eq[T] with
157+
new Eq[T]:
158158
def eqv(x: T, y: T): Boolean = body(x, y)
159159

160160
def summonAll[T: Type](using Quotes): List[Expr[Eq[_]]] =

docs/docs/reference/contextual/derivation.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ For the `Tree` ADT from above the following `Mirror` instances will be automatic
8484

8585
```scala
8686
// Mirror for Tree
87-
new Mirror.Sum with
87+
new Mirror.Sum:
8888
type MirroredType = Tree
8989
type MirroredElemTypes[T] = (Branch[T], Leaf[T])
9090
type MirroredMonoType = Tree[_]
@@ -96,7 +96,7 @@ new Mirror.Sum with
9696
case _: Leaf[_] => 1
9797

9898
// Mirror for Branch
99-
new Mirror.Product with
99+
new Mirror.Product:
100100
type MirroredType = Branch
101101
type MirroredElemTypes[T] = (Tree[T], Tree[T])
102102
type MirroredMonoType = Branch[_]
@@ -107,7 +107,7 @@ new Mirror.Product with
107107
new Branch(...)
108108

109109
// Mirror for Leaf
110-
new Mirror.Product with
110+
new Mirror.Product:
111111
type MirroredType = Leaf
112112
type MirroredElemTypes[T] = Tuple1[T]
113113
type MirroredMonoType = Leaf[_]
@@ -212,7 +212,7 @@ instance for the appropriate ADT subtype using the auxiliary method `check` (4).
212212

213213
```scala
214214
def eqSum[T](s: Mirror.SumOf[T], elems: List[Eq[_]]): Eq[T] =
215-
new Eq[T] with
215+
new Eq[T]:
216216
def eqv(x: T, y: T): Boolean =
217217
val ordx = s.ordinal(x) // (3)
218218
(s.ordinal(y) == ordx) && check(elems(ordx))(x, y) // (4)
@@ -223,7 +223,7 @@ on the `Eq` instances for the fields of the data type (5),
223223

224224
```scala
225225
def eqProduct[T](p: Mirror.ProductOf[T], elems: List[Eq[_]]): Eq[T] =
226-
new Eq[T] with
226+
new Eq[T]:
227227
def eqv(x: T, y: T): Boolean =
228228
iterator(x).zip(iterator(y)).zip(elems.iterator).forall { // (5)
229229
case ((x, y), elem) => check(elem)(x, y)
@@ -254,13 +254,13 @@ object Eq:
254254
def iterator[T](p: T) = p.asInstanceOf[Product].productIterator
255255

256256
def eqSum[T](s: Mirror.SumOf[T], elems: => List[Eq[_]]): Eq[T] =
257-
new Eq[T] with
257+
new Eq[T]:
258258
def eqv(x: T, y: T): Boolean =
259259
val ordx = s.ordinal(x)
260260
(s.ordinal(y) == ordx) && check(elems(ordx))(x, y)
261261

262262
def eqProduct[T](p: Mirror.ProductOf[T], elems: => List[Eq[_]]): Eq[T] =
263-
new Eq[T] with
263+
new Eq[T]:
264264
def eqv(x: T, y: T): Boolean =
265265
iterator(x).zip(iterator(y)).zip(elems.iterator).forall {
266266
case ((x, y), elem) => check(elem)(x, y)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Generally, context parameters may be defined either as a full parameter list `(p
4444

4545
Here are two other methods that have a context parameter of type `Ord[T]`:
4646
```scala
47-
def descending[T](using asc: Ord[T]): Ord[T] = new Ord[T] with
47+
def descending[T](using asc: Ord[T]): Ord[T] = new Ord[T]:
4848
def compare(x: T, y: T) = asc.compare(y, x)
4949

5050
def minimum[T](xs: List[T])(using Ord[T]) =

docs/docs/reference/enums/desugarEnums.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ If `E` contains at least one simple case, its companion object will define in ad
176176
follows.
177177

178178
```scala
179-
private def $new(_$ordinal: Int, $name: String) = new E with runtime.EnumValue with
179+
private def $new(_$ordinal: Int, $name: String) = new E with runtime.EnumValue:
180180
def ordinal = _$ordinal
181181
override def productPrefix = $name // if not overridden in `E`
182182
override def toString = $name // if not overridden in `E`

docs/docs/reference/enums/enums.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Enum values with `extends` clauses get expanded to anonymous class instances.
127127
For instance, the `Venus` value above would be defined like this:
128128

129129
```scala
130-
val Venus: Planet = new Planet(4.869E24, 6051800.0) with
130+
val Venus: Planet = new Planet(4.869E24, 6051800.0):
131131
def ordinal: Int = 1
132132
override def productPrefix: String = "Venus"
133133
override def toString: String = "Venus"

docs/docs/reference/metaprogramming/tasty-reflect.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ example, collects the pattern variables of a tree.
104104

105105
```scala
106106
def collectPatternVariables(tree: Tree)(implicit ctx: Context): List[Symbol] =
107-
val acc = new TreeAccumulator[List[Symbol]] with
107+
val acc = new TreeAccumulator[List[Symbol]]:
108108
def apply(syms: List[Symbol], tree: Tree)(implicit ctx: Context) =
109109
tree match
110110
case Bind(_, body) => apply(tree.symbol :: syms, body)

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ However, there is a potential hole due to pattern matching. Consider:
2121
```scala
2222
val imm: IArray[Int] = ...
2323
imm match
24-
case a: Array[Int] => a(0) = 1
24+
case a: Array[Int] => a(0) = 1
2525
```
2626

2727
The test will succeed at runtime since `IArray`s _are_ represented as
@@ -40,7 +40,7 @@ type `T` as match selector leads to the same problem:
4040

4141
```scala
4242
def f[T](x: T) = x match
43-
case a: Array[Int] => a(0) = 0
43+
case a: Array[Int] => a(0) = 0
4444
f(imm)
4545
```
4646

@@ -76,15 +76,15 @@ Here is the hierarchy of top-level classes and traits with their defined methods
7676

7777
```scala
7878
abstract class Any:
79-
def getClass
80-
def isInstanceOf
81-
def asInstanceOf
82-
def ==
83-
def !=
84-
def ##
85-
def equals
86-
def hashCode
87-
def toString
79+
def getClass
80+
def isInstanceOf
81+
def asInstanceOf
82+
def ==
83+
def !=
84+
def ##
85+
def equals
86+
def hashCode
87+
def toString
8888

8989
trait Matchable extends Any
9090

docs/docs/reference/other-new-features/type-test.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ We could create a type test at call site where the type test can be performed wi
5959

6060
```scala
6161
val tt: TypeTest[Any, String] =
62-
new TypeTest[Any, String] with
62+
new TypeTest[Any, String]:
6363
def unapply(s: Any): Option[s.type & String] =
6464
s match
6565
case s: String => Some(s)
@@ -70,7 +70,7 @@ f[AnyRef, String]("acb")(using tt)
7070

7171
The compiler will synthesize a new instance of a type test if none is found in scope as:
7272
```scala
73-
new TypeTest[A, B] with
73+
new TypeTest[A, B]:
7474
def unapply(s: A): Option[s.type & B] =
7575
s match
7676
case s: B => Some(s)

0 commit comments

Comments
 (0)