diff --git a/compiler/src/dotty/tools/dotc/config/MigrationVersion.scala b/compiler/src/dotty/tools/dotc/config/MigrationVersion.scala index f77aa0b06308..04b613680f9e 100644 --- a/compiler/src/dotty/tools/dotc/config/MigrationVersion.scala +++ b/compiler/src/dotty/tools/dotc/config/MigrationVersion.scala @@ -31,7 +31,7 @@ enum MigrationVersion(val warnFrom: SourceVersion, val errorFrom: SourceVersion) case ImportRename extends MigrationVersion(future, future) case ParameterEnclosedByParenthesis extends MigrationVersion(future, future) case XmlLiteral extends MigrationVersion(future, future) - case GivenSyntax extends MigrationVersion(future, never) + case GivenSyntax extends MigrationVersion(future, future) case ImplicitParamsWithoutUsing extends MigrationVersion(`3.7`, future) require(warnFrom.ordinal <= errorFrom.ordinal) diff --git a/tests/warn/abstract-givens-new.scala b/tests/neg/abstract-givens-new.scala similarity index 85% rename from tests/warn/abstract-givens-new.scala rename to tests/neg/abstract-givens-new.scala index c18ebe46acf7..1f0e641f9017 100644 --- a/tests/warn/abstract-givens-new.scala +++ b/tests/neg/abstract-givens-new.scala @@ -4,7 +4,7 @@ class C: trait T: given Int is C // ok - given intC: Int is C // warn + given intC: Int is C // error given intC2: (Int is C)() // ok given intC3: Int is C {} // also ok diff --git a/tests/neg/context-bounds-migration-future.check b/tests/neg/context-bounds-migration-future.check index f517a1e335c9..f56da5d6b28d 100644 --- a/tests/neg/context-bounds-migration-future.check +++ b/tests/neg/context-bounds-migration-future.check @@ -4,7 +4,3 @@ | method foo does not take more parameters | | longer explanation available when compiling with `-explain` --- Warning: tests/neg/context-bounds-migration-future.scala:6:6 -------------------------------------------------------- -6 |given [T]: C[T] = C[T]() - | ^ - | This old given syntax is no longer supported; use `=>` instead of `:` diff --git a/tests/neg/context-bounds-migration-future.scala b/tests/neg/context-bounds-migration-future.scala index 6d0e94c0b434..0816518d48a9 100644 --- a/tests/neg/context-bounds-migration-future.scala +++ b/tests/neg/context-bounds-migration-future.scala @@ -3,7 +3,7 @@ class C[T] def foo[X: C] = () -given [T]: C[T] = C[T]() +given [T] => C[T] = C[T]() def Test = foo(C[Int]()) // error diff --git a/tests/warn/old-givens.scala b/tests/neg/old-givens.scala similarity index 57% rename from tests/warn/old-givens.scala rename to tests/neg/old-givens.scala index 83e650df47d3..bd2acdfd2f8a 100644 --- a/tests/warn/old-givens.scala +++ b/tests/neg/old-givens.scala @@ -5,14 +5,14 @@ trait Ord[T]: class C[T] trait T: - given intC: C[Int] // warn + given intC: C[Int] // error given intC2: C[Int] () // OK - given [T]: Ord[T] with // warn // warn + given [T]: Ord[T] with // error // error def compare(x: T, y: T): Boolean = ??? - given [T](using Ord[T]): Ord[List[T]] with // warn // warn + given [T](using Ord[T]): Ord[List[T]] with // error // error def compare(x: List[T], y: List[T]): Boolean = ??? - def f[T: Ord : C]() = ??? // warn + def f[T: Ord : C]() = ??? // error diff --git a/tests/pos/hylolib-deferred-given/AnyCollection.scala b/tests/pos/hylolib-deferred-given/AnyCollection.scala index e2a946fca484..e13232c64954 100644 --- a/tests/pos/hylolib-deferred-given/AnyCollection.scala +++ b/tests/pos/hylolib-deferred-given/AnyCollection.scala @@ -48,7 +48,7 @@ given anyCollectionIsCollection: [T] => (tIsValue: Value[T]) => Collection[AnyCo //given elementIsValue: Value[Element] = tIsValue type Position = AnyValue - given positionIsValue: Value[Position] = anyValueIsValue + override given positionIsValue: Value[Position] = anyValueIsValue extension (self: AnyCollection[T]) { diff --git a/tests/pos/hylolib-deferred-given/BitArray.scala b/tests/pos/hylolib-deferred-given/BitArray.scala index d653f5e4d630..5f62dbc33241 100644 --- a/tests/pos/hylolib-deferred-given/BitArray.scala +++ b/tests/pos/hylolib-deferred-given/BitArray.scala @@ -341,7 +341,7 @@ given bitArrayIsCollection: Collection[BitArray] { //given elementIsValue: Value[Boolean] = booleanIsValue type Position = BitArray.Position - given positionIsValue: Value[BitArray.Position] = bitArrayPositionIsValue + override given positionIsValue: Value[BitArray.Position] = bitArrayPositionIsValue extension (self: BitArray) { diff --git a/tests/pos/hylolib-deferred-given/Collection.scala b/tests/pos/hylolib-deferred-given/Collection.scala index 6b5e7a762dc8..f24e5edf0eaa 100644 --- a/tests/pos/hylolib-deferred-given/Collection.scala +++ b/tests/pos/hylolib-deferred-given/Collection.scala @@ -10,7 +10,7 @@ trait Collection[Self] { /** The type of a position in the collection. */ type Position - given positionIsValue: Value[Position] + given positionIsValue: Value[Position] = compiletime.deferred extension (self: Self) { diff --git a/tests/pos/hylolib-deferred-given/HyArray.scala b/tests/pos/hylolib-deferred-given/HyArray.scala index e82ce06d920b..ac9b0a7bb756 100644 --- a/tests/pos/hylolib-deferred-given/HyArray.scala +++ b/tests/pos/hylolib-deferred-given/HyArray.scala @@ -185,7 +185,7 @@ given hyArrayIsCollection: [T] => (tIsValue: Value[T]) => Collection[HyArray[T]] //given elementIsValue: Value[T] = tIsValue type Position = Int - given positionIsValue: Value[Int] = intIsValue + override given positionIsValue: Value[Int] = intIsValue extension (self: HyArray[T]) { diff --git a/tests/pos/hylolib-deferred-given/Slice.scala b/tests/pos/hylolib-deferred-given/Slice.scala index 234b16dfc428..ed3a1cb2e4b8 100644 --- a/tests/pos/hylolib-deferred-given/Slice.scala +++ b/tests/pos/hylolib-deferred-given/Slice.scala @@ -32,7 +32,7 @@ given sliceIsCollection: [T] => (c: Collection[T]) => Collection[Slice[T]] { //given elementIsValue: Value[Element] = c.elementIsValue type Position = c.Position - given positionIsValue: Value[Position] = c.positionIsValue + override given positionIsValue: Value[Position] = c.positionIsValue extension (self: Slice[T]) { diff --git a/tests/pos/parsercombinators-ctx-bounds.scala b/tests/pos/parsercombinators-ctx-bounds.scala index 50338dbc2fa5..c337e19faf3a 100644 --- a/tests/pos/parsercombinators-ctx-bounds.scala +++ b/tests/pos/parsercombinators-ctx-bounds.scala @@ -25,8 +25,9 @@ given apply: [C, E] => Combinator[Apply[C, E]] { } } -given combine[A: Combinator, B: [X] =>> Combinator[X] { type Context = A.Context }] - : Combinator[Combine[A, B]] with +given combine + : [A: Combinator, B: [X] =>> Combinator[X] { type Context = A.Context }] + => Combinator[Combine[A, B]]: type Context = A.Context type Element = (A.Element, B.Element) extension(self: Combine[A, B]) diff --git a/tests/pos/parsercombinators-givens-2.scala b/tests/pos/parsercombinators-givens-2.scala index 4b00c3801716..f708b2613ffa 100644 --- a/tests/pos/parsercombinators-givens-2.scala +++ b/tests/pos/parsercombinators-givens-2.scala @@ -26,16 +26,14 @@ given apply: [C, E] => Combinator[Apply[C, E]] { } } -given combine[A, B, C](using - f: Combinator[A] { type Context = C }, - s: Combinator[B] { type Context = C } -): Combinator[Combine[A, B]] with { +given combine: [A, B, C] + => (f: Combinator[A] { type Context = C }, s: Combinator[B] { type Context = C }) + => Combinator[Combine[A, B]]: type Context = f.Context type Element = (f.Element, s.Element) extension(self: Combine[A, B]) { def parse(context: Context): Option[Element] = ??? } -} extension [A] (buf: mutable.ListBuffer[A]) def popFirst() = if buf.isEmpty then None diff --git a/tests/pos/parsercombinators-givens.scala b/tests/pos/parsercombinators-givens.scala index 1fa8080b0688..71000ac8134d 100644 --- a/tests/pos/parsercombinators-givens.scala +++ b/tests/pos/parsercombinators-givens.scala @@ -26,16 +26,14 @@ given apply: [C, E] => Combinator[Apply[C, E]] { } } -given combine[A, B](using - tracked val f: Combinator[A], - tracked val s: Combinator[B] { type Context = f.Context } -): Combinator[Combine[A, B]] with { +given combine + : [A, B] + => (tracked val f: Combinator[A], tracked val s: Combinator[B] { type Context = f.Context }) + => Combinator[Combine[A, B]]: type Context = f.Context type Element = (f.Element, s.Element) - extension(self: Combine[A, B]) { + extension (self: Combine[A, B]) def parse(context: Context): Option[Element] = ??? - } -} extension [A] (buf: mutable.ListBuffer[A]) def popFirst() = if buf.isEmpty then None diff --git a/tests/pos/parsercombinators-this.scala b/tests/pos/parsercombinators-this.scala index 19ac878c888f..cf25aea94d25 100644 --- a/tests/pos/parsercombinators-this.scala +++ b/tests/pos/parsercombinators-this.scala @@ -28,8 +28,9 @@ given apply: [C, E] => Combinator { } } -given combine[A: Combinator, B: Combinator { type Context = A.Context }] - : Combinator with +given combine + : [A: Combinator, B: Combinator { type Context = A.Context }] + => Combinator: type Self = Combine[A, B] type Context = A.Context type Element = (A.Element, B.Element)