Skip to content

Commit fab6cbc

Browse files
committed
Change more files to new syntax
1 parent fb91e30 commit fab6cbc

File tree

15 files changed

+26
-25
lines changed

15 files changed

+26
-25
lines changed

compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ object Scala3 with
212212
// end RangeOps
213213

214214
/** Sort symbol occurrences by their start position. */
215-
given OccurrenceOrdering: Ordering[SymbolOccurrence] = (x, y) =>
215+
given OccurrenceOrdering as Ordering[SymbolOccurrence] = (x, y) =>
216216
x.range -> y.range match
217217
case None -> _ | _ -> None => 0
218218
case Some(a) -> Some(b) =>

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ class Typer extends Namer
13021302
}
13031303

13041304
def typedWhileDo(tree: untpd.WhileDo)(implicit ctx: Context): Tree = {
1305-
given whileCtx: Context = Nullables.whileContext(tree.span)(using ctx)
1305+
given whileCtx as Context = Nullables.whileContext(tree.span)(using ctx)
13061306
val cond1 =
13071307
if (tree.cond eq EmptyTree) EmptyTree
13081308
else typed(tree.cond, defn.BooleanType)

tests/neg/i5978.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ object TextParser {
1111
as Conversion[Char, Position[CharSequence]] = ???
1212
}
1313

14-
1514
object Testcase {
1615
def main(args: Array[String]): Unit = {
1716
import TextParser._

tests/neg/i7078.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
trait A
22
class B extends A
33

4-
given g1 as _ <: A = B() // error: `<:' is only allowed for given with `inline' modifier // error
5-
6-
inline given g2 as _ <: A // error: <: A is not a class type
7-
def foo = 2 // error: `=' expected
4+
given g1 as _ <: A = B() // error: `_ <:' is only allowed for given with `inline' modifier // error
85

6+
inline given g2 as _ <: A: // error: `=' expected
7+
def foo = 2
8+
// error

tests/pos-custom-args/erased/i7868.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ object Coproduct {
1111

1212
object At {
1313

14-
given atHead[Head, Tail]: At[Head +: Tail, Head, 0] {
14+
given atHead[Head, Tail] as At[Head +: Tail, Head, 0] {
1515
def cast: Head <:< Head +: Tail = summon[Head <:< Head +: Tail]
1616
}
1717

18-
given atTail[Head, Tail, Value, NextIndex <: Int](using atNext: At[Tail, Value, NextIndex]) as At[Head +: Tail, Value, S[NextIndex]] {
18+
given atTail[Head, Tail, Value, NextIndex <: Int]
19+
(using atNext: At[Tail, Value, NextIndex])
20+
as At[Head +: Tail, Value, S[NextIndex]]:
1921
val cast: Value <:< Head +: Tail = atNext.cast
20-
}
2122

2223
given [A](using A) as (() => A)= { () => summon[A]}
2324
}

tests/pos-custom-args/erased/i7878.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ object Boom {
22
import scala.compiletime._
33
trait Fail[A <: Int, B <: Int]
44

5-
erased inline given fail[X <: Int, Y <: Int]: Fail[X, Y] = {
5+
erased inline given fail[X <: Int, Y <: Int] as Fail[X, Y] = {
66
scala.compiletime.summonFrom {
77
case t: Fail[X, y] if constValue[y] < constValue[Y] => ???
88
}

tests/pos/combine.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ trait Semigroup[A] {
22
def (x: A).combine(y: A): A
33
}
44
given Semigroup[Int] = ???
5-
given [A, B](using Semigroup[A], Semigroup[B]): Semigroup[(A, B)] = ???
5+
given [A, B](using Semigroup[A], Semigroup[B]) as Semigroup[(A, B)] = ???
66
object Test extends App {
77
((1, 1)) combine ((2, 2)) // doesn't compile
88
((1, 1): (Int, Int)) combine (2, 2) // compiles

tests/pos/i7851.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ object Wrapper { type Aux[T <: Tuple, WrappedT0 <: Tuple] = Wrapper[T] { type Wr
88

99
given Wrapper[Unit] { type WrappedT = Unit }
1010

11-
given [T: Wrappable]: Wrapper[T] { type WrappedT = Wrapped[T] }
11+
given [T: Wrappable] as Wrapper[T] { type WrappedT = Wrapped[T] }
1212

13-
given [H: Wrappable, T <: Tuple, WrappedT0 <: Tuple](using Wrapper.Aux[T, WrappedT0]): Wrapper[H *: T] {
13+
given [H: Wrappable, T <: Tuple, WrappedT0 <: Tuple]
14+
(using Wrapper.Aux[T, WrappedT0])
15+
as Wrapper[H *: T]:
1416
type WrappedT = Wrapped[H] *: WrappedT0
15-
}
1617

1718
def wrappedFunction[F, FArgs <: Tuple, WrapperFArgs <: Tuple, R: Wrappable](
1819
function: F

tests/pos/i8198.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ trait Eq[A] {
55

66
case class Id[T](id: T)
77

8-
given idEq[A](using eqA: Eq[A]): Eq[Id[A]] = new {
8+
given idEq[A](using eqA: Eq[A]) as Eq[Id[A]] = new {
99
def (i1: Id[A]) === (i2: Id[A]) = !(i1.id /== i2.id)
1010
}

tests/pos/multi-given.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ def foo(implicit a: A, b: B, c: C) = "foo"
77

88
given A, B {}
99

10-
given ops: A with B {}
10+
given ops as A with B {}

0 commit comments

Comments
 (0)