diff --git a/tests/neg/i4935.scala b/tests/neg/i4935.scala index 29ccd3cb8ec5..434637bf20dc 100644 --- a/tests/neg/i4935.scala +++ b/tests/neg/i4935.scala @@ -1,3 +1,3 @@ object Foo { - val (A, B) = () // error // error + val (A, B) = (): @unchecked // error // error } diff --git a/tests/neg/i7879.scala b/tests/neg/i7879.scala index a5091886fe5e..9fc3f5c64609 100644 --- a/tests/neg/i7879.scala +++ b/tests/neg/i7879.scala @@ -1,4 +1,4 @@ object Test { - val head1 +: _ = List(1).view + val head1 +: _ = List(1).view: @unchecked val _: Int = head1 // error -} \ No newline at end of file +} diff --git a/tests/neg/i9310.scala b/tests/neg/i9310.scala index 7e57e8c99092..be430c93f635 100644 --- a/tests/neg/i9310.scala +++ b/tests/neg/i9310.scala @@ -1,5 +1,5 @@ //AE-d101cfe6d25117a51897609e673f6c8e74d31e6e -val foo @ this = 0 +val foo @ this = 0: @unchecked class Foo { foo { } // error -} \ No newline at end of file +} diff --git a/tests/neg/refutable-pattern-binding-messages.check b/tests/neg/refutable-pattern-binding-messages.check index 5a9d85fd4447..b1b8866e174f 100644 --- a/tests/neg/refutable-pattern-binding-messages.check +++ b/tests/neg/refutable-pattern-binding-messages.check @@ -1,3 +1,11 @@ +-- Error: tests/neg/refutable-pattern-binding-messages.scala:5:14 ------------------------------------------------------ +5 | val Positive(p) = 5 // error: refutable extractor + | ^^^^^^^^^^^^^^^ + | pattern binding uses refutable extractor `Test.Positive` + | + | If this usage is intentional, this can be communicated by adding `: @unchecked` after the expression, + | which may result in a MatchError at runtime. + | This patch can be rewritten automatically under -rewrite -source 3.2-migration. -- Error: tests/neg/refutable-pattern-binding-messages.scala:6:14 ------------------------------------------------------ 6 | for Positive(i) <- List(1, 2, 3) do () // error: refutable extractor | ^^^^^^^^^^^ @@ -6,6 +14,14 @@ | If this usage is intentional, this can be communicated by adding the `case` keyword before the full pattern, | which will result in a filtering for expression (using `withFilter`). | This patch can be rewritten automatically under -rewrite -source 3.2-migration. +-- Error: tests/neg/refutable-pattern-binding-messages.scala:10:20 ----------------------------------------------------- +10 | val i :: is = List(1, 2, 3) // error: pattern type more specialized + | ^^^^^^^^^^^^^ + | pattern's type ::[Int] is more specialized than the right hand side expression's type List[Int] + | + | If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression, + | which may result in a MatchError at runtime. + | This patch can be rewritten automatically under -rewrite -source 3.2-migration. -- Error: tests/neg/refutable-pattern-binding-messages.scala:11:11 ----------------------------------------------------- 11 | for ((x: String) <- xs) do () // error: pattern type more specialized | ^^^^^^ @@ -22,22 +38,6 @@ | If the narrowing is intentional, this can be communicated by adding the `case` keyword before the full pattern, | which will result in a filtering for expression (using `withFilter`). | This patch can be rewritten automatically under -rewrite -source 3.2-migration. --- Error: tests/neg/refutable-pattern-binding-messages.scala:5:14 ------------------------------------------------------ -5 | val Positive(p) = 5 // error: refutable extractor - | ^^^^^^^^^^^^^^^ - | pattern binding uses refutable extractor `Test.Positive` - | - | If this usage is intentional, this can be communicated by adding `: @unchecked` after the expression, - | which may result in a MatchError at runtime. - | This patch can be rewritten automatically under -rewrite -source 3.2-migration. --- Error: tests/neg/refutable-pattern-binding-messages.scala:10:20 ----------------------------------------------------- -10 | val i :: is = List(1, 2, 3) // error: pattern type more specialized - | ^^^^^^^^^^^^^ - | pattern's type ::[Int] is more specialized than the right hand side expression's type List[Int] - | - | If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression, - | which may result in a MatchError at runtime. - | This patch can be rewritten automatically under -rewrite -source 3.2-migration. -- Error: tests/neg/refutable-pattern-binding-messages.scala:16:10 ----------------------------------------------------- 16 | val 1 = 2 // error: pattern type does not match | ^ diff --git a/tests/neg/t5702-neg-bad-and-wild.check b/tests/neg/t5702-neg-bad-and-wild.check index 731195411069..1dec2ba80115 100644 --- a/tests/neg/t5702-neg-bad-and-wild.check +++ b/tests/neg/t5702-neg-bad-and-wild.check @@ -27,14 +27,14 @@ | | longer explanation available when compiling with `-explain` -- [E032] Syntax Error: tests/neg/t5702-neg-bad-and-wild.scala:23:17 --------------------------------------------------- -23 | val K(ns @ _*, xx) = k // error: pattern expected // error +23 | val K(ns @ _*, xx) = k: @unchecked // error: pattern expected // error | ^ | pattern expected | | longer explanation available when compiling with `-explain` -- [E161] Naming Error: tests/neg/t5702-neg-bad-and-wild.scala:24:10 --------------------------------------------------- -24 | val K(x) = k // error: x is already defined as value x - | ^^^^^^^^^^^^ +24 | val K(x) = k: @unchecked // error: x is already defined as value x + | ^^^^^^^^^^^^^^^^^^^^^^^^ | x is already defined as value x | | Note that overloaded methods must all be defined in the same group of toplevel definitions @@ -51,24 +51,8 @@ | | longer explanation available when compiling with `-explain` -- [E045] Cyclic Error: tests/neg/t5702-neg-bad-and-wild.scala:23:19 --------------------------------------------------- -23 | val K(ns @ _*, xx) = k // error: pattern expected // error +23 | val K(ns @ _*, xx) = k: @unchecked // error: pattern expected // error | ^ | Recursive value $1$ needs type | | longer explanation available when compiling with `-explain` --- Warning: tests/neg/t5702-neg-bad-and-wild.scala:22:20 --------------------------------------------------------------- -22 | val K(x @ _*) = k - | ^ - | pattern's type Int* does not match the right hand side expression's type Int - | - | If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression, - | which may result in a MatchError at runtime. - | This patch can be rewritten automatically under -rewrite -source 3.2-migration. --- Warning: tests/neg/t5702-neg-bad-and-wild.scala:25:20 --------------------------------------------------------------- -25 | val (b, _ * ) = (5,6) // ok - | ^^^^^ - | pattern's type Int* does not match the right hand side expression's type Int - | - | If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression, - | which may result in a MatchError at runtime. - | This patch can be rewritten automatically under -rewrite -source 3.2-migration. diff --git a/tests/neg/t5702-neg-bad-and-wild.scala b/tests/neg/t5702-neg-bad-and-wild.scala index 95d00c270e89..5fc739f91bca 100644 --- a/tests/neg/t5702-neg-bad-and-wild.scala +++ b/tests/neg/t5702-neg-bad-and-wild.scala @@ -19,12 +19,11 @@ object Test { // good syntax, bad semantics, detected by typer //gowild.scala:14: error: star patterns must correspond with varargs parameters - val K(x @ _*) = k - val K(ns @ _*, xx) = k // error: pattern expected // error - val K(x) = k // error: x is already defined as value x - val (b, _ * ) = (5,6) // ok + val K(x @ _*) = k: @unchecked + val K(ns @ _*, xx) = k: @unchecked // error: pattern expected // error + val K(x) = k: @unchecked // error: x is already defined as value x + val (b, _ * ) = (5,6): @unchecked // ok // no longer complains //bad-and-wild.scala:15: error: ')' expected but '}' found. } } - diff --git a/tests/neg/trailingCommas.scala b/tests/neg/trailingCommas.scala index 5ddde5475f51..b7403645fd8f 100644 --- a/tests/neg/trailingCommas.scala +++ b/tests/neg/trailingCommas.scala @@ -23,7 +23,7 @@ trait FunTypeParamClause { def f[A, B, ] } // error // error trait SimpleType { def f: (Int, String, ) } // error trait FunctionArgTypes { def f: (Int, String, ) => Boolean } // error -trait SimplePattern { val (foo, bar, ) = null: Any } // error +trait SimplePattern { val (foo, bar, ) = null: Any @unchecked } // error trait ImportSelectors { import foo.{ Ev0, Ev1, } } // error @@ -79,4 +79,4 @@ val a, b, c, = (1, 2, 3) // error -val x, y, z, = (1, 2, 3) // error \ No newline at end of file +val x, y, z, = (1, 2, 3) // error diff --git a/tests/pos-deep-subtype/i7580.scala b/tests/pos-deep-subtype/i7580.scala index 2e22da7fead9..ba14d9f40b58 100644 --- a/tests/pos-deep-subtype/i7580.scala +++ b/tests/pos-deep-subtype/i7580.scala @@ -1,5 +1,5 @@ def foo = - val List(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, _:_*) = List.fill(25)(0) + val List(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, _:_*) = List.fill(25)(0): @unchecked () diff --git a/tests/pos-macros/i12188b/Macro_1.scala b/tests/pos-macros/i12188b/Macro_1.scala index fa9ea10e666a..9743f14a6b3a 100644 --- a/tests/pos-macros/i12188b/Macro_1.scala +++ b/tests/pos-macros/i12188b/Macro_1.scala @@ -6,7 +6,7 @@ object MatchTest { def testImpl[T](objExpr: Expr[T])(using Quotes): Expr[Unit] = { import quotes.reflect.* // test that the extractors work - val Inlined(None, Nil, Block(Nil, Match(param @ Ident("a"), List(CaseDef(Literal(IntConstant(1)), None, Block(Nil, Literal(UnitConstant()))), CaseDef(Wildcard(), None, Block(Nil, Literal(UnitConstant()))))))) = objExpr.asTerm + val Inlined(None, Nil, Block(Nil, Match(param @ Ident("a"), List(CaseDef(Literal(IntConstant(1)), None, Block(Nil, Literal(UnitConstant()))), CaseDef(Wildcard(), None, Block(Nil, Literal(UnitConstant()))))))) = objExpr.asTerm: @unchecked // test that the constructors work Block(Nil, Match(param, List(CaseDef(Literal(IntConstant(1)), None, Block(Nil, Literal(UnitConstant()))), CaseDef(Wildcard(), None, Block(Nil, Literal(UnitConstant())))))).asExprOf[Unit] } diff --git a/tests/pos-macros/i6435.scala b/tests/pos-macros/i6435.scala index 82310cfdc55a..fb5ce2454630 100644 --- a/tests/pos-macros/i6435.scala +++ b/tests/pos-macros/i6435.scala @@ -3,10 +3,10 @@ class Foo { def f(sc: quoted.Expr[StringContext])(using Quotes): Unit = { - val '{ StringContext(${parts}*) } = sc + val '{ StringContext(${parts}*) } = sc: @unchecked val ps0: Expr[Seq[String]] = parts - val '{ StringContext(${Varargs(parts2)}*) } = sc + val '{ StringContext(${Varargs(parts2)}*) } = sc: @unchecked val ps: Seq[Expr[String]] = parts2 } -} \ No newline at end of file +} diff --git a/tests/pos-macros/i6998.scala b/tests/pos-macros/i6998.scala index 032a58b795e2..e19856919323 100644 --- a/tests/pos-macros/i6998.scala +++ b/tests/pos-macros/i6998.scala @@ -1,5 +1,5 @@ import scala.quoted.* def foo(using Quotes) : Unit = { - val '{ $f : (Int => Double) } = ??? : Expr[Any] + val '{ $f : (Int => Double) } = ??? : Expr[Any] @unchecked } diff --git a/tests/pos-macros/i7204.scala b/tests/pos-macros/i7204.scala index ad7a27670de8..f0fc9e704807 100644 --- a/tests/pos-macros/i7204.scala +++ b/tests/pos-macros/i7204.scala @@ -3,6 +3,6 @@ import scala.quoted.* object Foo { def impl(using Quotes) : Unit = { import quotes.reflect.* - val Select(_, _) = (??? : Term) + val Select(_, _) = (??? : Term): @unchecked } } diff --git a/tests/pos-macros/i8577a/Main_2.scala b/tests/pos-macros/i8577a/Main_2.scala index 5a0f6b609f81..6d8234420447 100644 --- a/tests/pos-macros/i8577a/Main_2.scala +++ b/tests/pos-macros/i8577a/Main_2.scala @@ -5,5 +5,5 @@ def main: Unit = extension (inline ctx: Macro.StrCtx) inline def unapplySeq(inline input: Int): Option[Seq[Int]] = ${ implUnapply('ctx, 'input) } - val mac"$x" = 1 + val mac"$x" = 1: @unchecked assert(x == 1) diff --git a/tests/pos-macros/i8577b/Main_2.scala b/tests/pos-macros/i8577b/Main_2.scala index 789e572bd5aa..438d70cd0593 100644 --- a/tests/pos-macros/i8577b/Main_2.scala +++ b/tests/pos-macros/i8577b/Main_2.scala @@ -5,5 +5,5 @@ def main: Unit = extension (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: U): Option[Seq[U]] = ${ implUnapply('ctx, 'input) } - val mac"$x" = 1 + val mac"$x" = 1: @unchecked assert(x == 1) diff --git a/tests/pos-macros/i8577c/Main_2.scala b/tests/pos-macros/i8577c/Main_2.scala index 4f42c7635ec5..cfa1e323c501 100644 --- a/tests/pos-macros/i8577c/Main_2.scala +++ b/tests/pos-macros/i8577c/Main_2.scala @@ -5,5 +5,5 @@ def main: Unit = extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq(inline input: T): Option[Seq[T]] = ${ implUnapply('ctx, 'input) } - val mac"$x" = 1 + val mac"$x" = 1: @unchecked assert(x == 1) diff --git a/tests/pos-macros/i8577d/Main_2.scala b/tests/pos-macros/i8577d/Main_2.scala index a87f06503b31..bd83fcbb3796 100644 --- a/tests/pos-macros/i8577d/Main_2.scala +++ b/tests/pos-macros/i8577d/Main_2.scala @@ -5,5 +5,5 @@ def main: Unit = extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: T): Option[Seq[T]] = ${ implUnapply('ctx, 'input) } - val mac"$x" = 1 + val mac"$x" = 1: @unchecked assert(x == 1) diff --git a/tests/pos-macros/i8577e/Main_2.scala b/tests/pos-macros/i8577e/Main_2.scala index 598d18d2faec..4aa2e3050029 100644 --- a/tests/pos-macros/i8577e/Main_2.scala +++ b/tests/pos-macros/i8577e/Main_2.scala @@ -5,5 +5,5 @@ def main: Unit = extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: U): Option[Seq[U]] = ${ implUnapply('ctx, 'input) } - val mac"$x" = 1 + val mac"$x" = 1: @unchecked assert(x == 1) diff --git a/tests/pos-macros/i8577f/Main_2.scala b/tests/pos-macros/i8577f/Main_2.scala index fd1bb3e6186f..e30a49086677 100644 --- a/tests/pos-macros/i8577f/Main_2.scala +++ b/tests/pos-macros/i8577f/Main_2.scala @@ -5,8 +5,8 @@ def main: Unit = extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: (T, U)): Option[Seq[(T, U)]] = ${ implUnapply('ctx, 'input) } - val mac"$x" = (1, 2) + val mac"$x" = (1, 2): @unchecked assert(x == (1, 2)) - val mac"$y" = (1, "a") + val mac"$y" = (1, "a"): @unchecked assert(y == (1, "a")) diff --git a/tests/pos-macros/i8577g/Main_2.scala b/tests/pos-macros/i8577g/Main_2.scala index 4998b9962802..477d858b87b2 100644 --- a/tests/pos-macros/i8577g/Main_2.scala +++ b/tests/pos-macros/i8577g/Main_2.scala @@ -5,5 +5,5 @@ def main: Unit = extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: T | U): Option[Seq[T | U]] = ${ implUnapply('ctx, 'input) } - val mac"$x" = 1 + val mac"$x" = 1: @unchecked assert(x == 1) diff --git a/tests/pos-macros/i8577h/Main_2.scala b/tests/pos-macros/i8577h/Main_2.scala index 9fe2565a0ec3..1fec32878a3a 100644 --- a/tests/pos-macros/i8577h/Main_2.scala +++ b/tests/pos-macros/i8577h/Main_2.scala @@ -5,5 +5,5 @@ def main: Unit = extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: U | T): Option[Seq[T | U]] = ${ implUnapply('ctx, 'input) } - val mac"$x" = 1 + val mac"$x" = 1: @unchecked assert(x == 1) diff --git a/tests/pos-macros/tasty-constant-type/Macro_1.scala b/tests/pos-macros/tasty-constant-type/Macro_1.scala index 86250bca306b..d9d8bdbd7860 100644 --- a/tests/pos-macros/tasty-constant-type/Macro_1.scala +++ b/tests/pos-macros/tasty-constant-type/Macro_1.scala @@ -9,8 +9,8 @@ object Macro { def impl[A <: Int : Type, B <: Int : Type](using Quotes) : Expr[AddInt[A, B]] = { import quotes.reflect.* - val ConstantType(IntConstant(v1)) = TypeRepr.of[A] - val ConstantType(IntConstant(v2)) = TypeRepr.of[B] + val ConstantType(IntConstant(v1)) = TypeRepr.of[A]: @unchecked + val ConstantType(IntConstant(v2)) = TypeRepr.of[B]: @unchecked Literal(IntConstant(v1 + v2)).tpe.asType match case '[t] => '{ null: AddInt[A, B] { type Out = t } } diff --git a/tests/pos/endmarkers.scala b/tests/pos/endmarkers.scala index 5b85ce3763cd..ff21bed2fc11 100644 --- a/tests/pos/endmarkers.scala +++ b/tests/pos/endmarkers.scala @@ -19,7 +19,7 @@ package p1.p2: this() if x > 0 then val a :: b = - x :: Nil + (x :: Nil): @unchecked end val var y = x @@ -55,4 +55,4 @@ package p1.p2: def ff: String = x.f end extension -end p2 \ No newline at end of file +end p2 diff --git a/tests/pos/extractor-types.scala b/tests/pos/extractor-types.scala index 200279be6ffe..5648870037a6 100644 --- a/tests/pos/extractor-types.scala +++ b/tests/pos/extractor-types.scala @@ -1,12 +1,12 @@ package p1 { object Ex { def unapply(p: Any): Option[_ <: Int] = null } - object Foo { val Ex(_) = null } + object Foo { val Ex(_) = null: @unchecked } } // a.scala:2: error: error during expansion of this match (this is a scalac bug). // The underlying error was: type mismatch; // found : Some[_$1(in value x$1)] where type _$1(in value x$1) // required: Some[_$1(in method unapply)] -// object Foo { val Ex(_) = null } +// object Foo { val Ex(_) = null: @unchecked } // ^ // one error found diff --git a/tests/pos/i15188.scala b/tests/pos/i15188.scala index 5dfdd5204faa..e4bab62c9822 100644 --- a/tests/pos/i15188.scala +++ b/tests/pos/i15188.scala @@ -4,6 +4,6 @@ extension [T] (ctx: O.type) inline def unapplySeq(input: T): Option[Seq[T]] = So @main def Main = { - val O(x) = 3 + val O(x) = 3: @unchecked println(s"x: $x") } diff --git a/tests/pos/i15188b.scala b/tests/pos/i15188b.scala index cdad3aff5099..705b0dec52b7 100644 --- a/tests/pos/i15188b.scala +++ b/tests/pos/i15188b.scala @@ -4,5 +4,5 @@ extension (ctx: C) inline def unapply(input: String): Option[String] = Some("hi" @main def run = { val O = new C - val O(x) = "3" + val O(x) = "3": @unchecked } diff --git a/tests/pos/i1540.scala b/tests/pos/i1540.scala index 0fdfea23555d..a3e47b584e57 100644 --- a/tests/pos/i1540.scala +++ b/tests/pos/i1540.scala @@ -8,7 +8,7 @@ object Casey1 { def unapply(a: Casey1) = a } object Test { def main(args: Array[String]): Unit = { - val c @ Casey1(x) = new Casey1(0) + val c @ Casey1(x) = new Casey1(0): @unchecked assert(x == c.get) } } diff --git a/tests/pos/i1540b.scala b/tests/pos/i1540b.scala index f4408b0c7aab..24f205db1671 100644 --- a/tests/pos/i1540b.scala +++ b/tests/pos/i1540b.scala @@ -8,7 +8,7 @@ object Casey1 { def unapply[T](a: Casey1[T]) = a } object Test { def main(args: Array[String]): Unit = { - val c @ Casey1(x) = new Casey1(0) + val c @ Casey1(x) = new Casey1(0): @unchecked assert(x == c.get) } } diff --git a/tests/pos/i15650.scala b/tests/pos/i15650.scala index 3e335756f43a..afc2cf8f7347 100644 --- a/tests/pos/i15650.scala +++ b/tests/pos/i15650.scala @@ -12,7 +12,7 @@ object meta: def unapply(using Quotes)(using TC)(tr: quotes.reflect.TypeRepr): Option[Rational] = ??? def foo(using Quotes)(p: quotes.reflect.TypeRepr): Unit = - val rationalTE(e) = p // warn: pattern binding uses refutable extractor `meta.rationalTE` + val rationalTE(e) = p: @unchecked def bar(using Quotes)(using TC)(p: quotes.reflect.TypeRepr): Unit = - val rationalTC(c) = p // warn: pattern binding uses refutable extractor `meta.rationalTC` + val rationalTC(c) = p: @unchecked diff --git a/tests/pos/i7532.scala b/tests/pos/i7532.scala index 0ded97411b2c..571a6a7961de 100644 --- a/tests/pos/i7532.scala +++ b/tests/pos/i7532.scala @@ -13,6 +13,6 @@ class Tasty { object Foo { def impl(using tasty: Tasty) : Unit = { import tasty.{_, given} - val Select() = (??? : Term) + val Select() = (??? : Term): @unchecked } -} \ No newline at end of file +} diff --git a/tests/pos/inline-i1773.scala b/tests/pos/inline-i1773.scala index 4791856bb9a7..872bc8aae245 100644 --- a/tests/pos/inline-i1773.scala +++ b/tests/pos/inline-i1773.scala @@ -7,7 +7,7 @@ object Test { } def main(args: Array[String]): Unit = { - val q"class $name extends $parent" = new Object + val q"class $name extends $parent" = new Object: @unchecked println(name) println(parent) } diff --git a/tests/pos/irrefutable.scala b/tests/pos/irrefutable.scala index 0a792b644a09..abee73538bc4 100644 --- a/tests/pos/irrefutable.scala +++ b/tests/pos/irrefutable.scala @@ -1,15 +1,4 @@ -// The test which this should perform but does not -// is that f1 is recognized as irrefutable and f2 is not -// This can be recognized via the generated classes: -// -// A$$anonfun$f1$1.class -// A$$anonfun$f2$1.class -// A$$anonfun$f2$2.class -// -// The extra one in $f2$ is the filter. -// -// !!! Marking with exclamation points so maybe someday -// this test will be finished. +// This tests that f1 is recognized as an irrefutable pattern and f2 is not class A { case class Foo[T](x: T) @@ -17,6 +6,6 @@ class A { for (Foo(x: Int) <- xs) yield x } def f2(xs: List[Foo[Any]]) = { - for (Foo(x: Int) <- xs) yield x + for (case Foo(x: Int) <- xs) yield x } } diff --git a/tests/pos/patdef.scala b/tests/pos/patdef.scala index 96d861c9a72b..f08730bb5d15 100644 --- a/tests/pos/patdef.scala +++ b/tests/pos/patdef.scala @@ -4,6 +4,6 @@ object Test { val c: Any = C(1) - val C(x) = c + val C(x) = c: @unchecked } diff --git a/tests/pos/reference/vararg-patterns.scala b/tests/pos/reference/vararg-patterns.scala index 3ddc860b7329..0c438ef0d7ef 100644 --- a/tests/pos/reference/vararg-patterns.scala +++ b/tests/pos/reference/vararg-patterns.scala @@ -1,8 +1,8 @@ package varargPatterns object t1 extends App { - val List(1, 2, xs *) = List(1, 2, 3) + val List(1, 2, xs *) = List(1, 2, 3): @unchecked println(xs) - val List(1, 2, _ *) = List(1, 2, 3) + val List(1, 2, _ *) = List(1, 2, 3): @unchecked } @main def Test = val arr = Array(0, 1, 2, 3) diff --git a/tests/pos/repeatedArgs213.scala b/tests/pos/repeatedArgs213.scala index b1be56cf65f8..585ecfc6a2c5 100644 --- a/tests/pos/repeatedArgs213.scala +++ b/tests/pos/repeatedArgs213.scala @@ -12,7 +12,7 @@ class repeatedArgs { Paths.get("Hello", "World") Paths.get("Hello", xs*) - val List(_, others*) = xs.toList // toList should not be needed, see #4790 + val List(_, others*) = xs.toList: @unchecked // toList should not be needed, see #4790 val x: immutable.Seq[String] = others } @@ -23,7 +23,7 @@ class repeatedArgs { Paths.get("Hello", "World") Paths.get("Hello", xs*) - val List(_, others*) = xs.toList // toList should not be needed, see #4790 + val List(_, others*) = xs.toList: @unchecked // toList should not be needed, see #4790 val x: immutable.Seq[String] = others } } diff --git a/tests/pos/t0068.scala b/tests/pos/t0068.scala index beb2c7c0abbd..d548bfe9128d 100644 --- a/tests/pos/t0068.scala +++ b/tests/pos/t0068.scala @@ -1,6 +1,6 @@ class E { def f() = { - val (_::l1) = List(1,2,3); + val (_::l1) = List(1,2,3): @unchecked; l1.tail; } } diff --git a/tests/pos/t122.scala b/tests/pos/t122.scala index 630e24ce4a77..b8d316c076ff 100644 --- a/tests/pos/t122.scala +++ b/tests/pos/t122.scala @@ -1,4 +1,4 @@ class L { - val List(v:Int, 2) = List(2, v:Int) - val (a:Int, b:Int) = (1, a) + val List(v:Int, 2) = List(2, v:Int): @unchecked + val (a:Int, b:Int) = (1, a): @unchecked } diff --git a/tests/pos/t6205.scala b/tests/pos/t6205.scala index 52078bd5f46f..a50350d20376 100644 --- a/tests/pos/t6205.scala +++ b/tests/pos/t6205.scala @@ -2,7 +2,7 @@ class A[T] class Test1 { def x(backing: Map[A[_], Any]) = - for( (k: A[kt], v) <- backing) + for(case (k: A[kt], v) <- backing) yield (k: A[kt]) } diff --git a/tests/pos/tailcall/t6479.scala b/tests/pos/tailcall/t6479.scala index e4a4ff6011ae..7060d825a9b0 100644 --- a/tests/pos/tailcall/t6479.scala +++ b/tests/pos/tailcall/t6479.scala @@ -30,7 +30,7 @@ object TailrecAfterTryCatch { @annotation.tailrec final def good3(): Unit = { - val 1 = 2 + val 1 = 2: @unchecked try { return } catch { diff --git a/tests/pos/test-desugar.scala b/tests/pos/test-desugar.scala index 89627ff63ce7..2d4b0a3bb6ad 100644 --- a/tests/pos/test-desugar.scala +++ b/tests/pos/test-desugar.scala @@ -36,11 +36,11 @@ object desugar { val xs: List[Int] = Cons(1, Cons(2, Nil)) - val Cons(y, ys) = xs - val Cons(z, _) = xs - val Cons(_, _) = xs + val Cons(y, ys) = xs: @unchecked + val Cons(z, _) = xs: @unchecked + val Cons(_, _) = xs: @unchecked - val (cons: Cons[Int]) = xs + val (cons: Cons[Int]) = xs: @unchecked val x1, y1, z1: Int = 1 } @@ -49,7 +49,7 @@ object desugar { x :: y :: Nil - val x :: y :: Nil = list + val x :: y :: Nil = list: @unchecked } diff --git a/tests/pos/trailing-comma-pattern.scala b/tests/pos/trailing-comma-pattern.scala index 878b3af7748a..1b9b221164e3 100644 --- a/tests/pos/trailing-comma-pattern.scala +++ b/tests/pos/trailing-comma-pattern.scala @@ -1,3 +1,3 @@ object Test: val List(x, y, _*, - ) = List(1, 2, 3) + ) = List(1, 2, 3): @unchecked diff --git a/tests/pos/trailingCommas/trailingCommas.scala b/tests/pos/trailingCommas/trailingCommas.scala index 1ec185be78d2..68c3ef798ac6 100644 --- a/tests/pos/trailingCommas/trailingCommas.scala +++ b/tests/pos/trailingCommas/trailingCommas.scala @@ -123,7 +123,7 @@ trait SimplePattern { val ( foo, bar, - ) = null: Any + ) = null: Any @unchecked // test '@' syntax in patterns Some(1) match { @@ -139,7 +139,7 @@ trait SimplePattern { // test varargs in patterns val List(x, y, z*, - ) = 42 :: 17 :: Nil + ) = (42 :: 17 :: Nil): @unchecked } trait ImportSelectors { @@ -165,4 +165,4 @@ trait Bindings { object `package` { sealed trait Ev0; implicit object Ev0 extends Ev0 sealed trait Ev1; implicit object Ev1 extends Ev1 -} \ No newline at end of file +} diff --git a/tests/pos/vararg-pattern.scala b/tests/pos/vararg-pattern.scala index 3b40cd19501b..0710581452b6 100644 --- a/tests/pos/vararg-pattern.scala +++ b/tests/pos/vararg-pattern.scala @@ -5,5 +5,5 @@ object Test { println(ys) } - val List(1, 2, x*) = List(1, 2, 3, 4) + val List(1, 2, x*) = List(1, 2, 3, 4): @unchecked } diff --git a/tests/run-macros/f-interpolation-1/FQuote_1.scala b/tests/run-macros/f-interpolation-1/FQuote_1.scala index 4ca632c18280..275ee6f80166 100644 --- a/tests/run-macros/f-interpolation-1/FQuote_1.scala +++ b/tests/run-macros/f-interpolation-1/FQuote_1.scala @@ -43,7 +43,7 @@ object FQuote { } // [a0, ...]: Any* - val Typed(Repeated(allArgs, _), _) = args.asTerm.underlyingArgument + val Typed(Repeated(allArgs, _), _) = args.asTerm.underlyingArgument: @unchecked for ((arg, part) <- allArgs.zip(parts.tail)) { if (part.startsWith("%d") && !(arg.tpe <:< TypeRepr.of[Int])) { diff --git a/tests/run-macros/paramSymss/Macro_1.scala b/tests/run-macros/paramSymss/Macro_1.scala index 65c31df30626..6e283204b8d7 100644 --- a/tests/run-macros/paramSymss/Macro_1.scala +++ b/tests/run-macros/paramSymss/Macro_1.scala @@ -5,7 +5,7 @@ inline def showParamSyms(inline x: Any): String = def showParamSymsExpr(using Quotes)(x: Expr[Any]): Expr[String] = import quotes.reflect.* - val '{ $y: Any } = x // Drop Inlined not to access the symbol + val '{ $y: Any } = x: @unchecked // Drop Inlined not to access the symbol val sym = y.asTerm.symbol Expr( s"""sym: ${sym.fullName} diff --git a/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala index 5f53fd1a7ade..d70ae931ed2c 100644 --- a/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala @@ -70,7 +70,7 @@ object UnsafeExpr { } private def paramsAndBody[R](using Quotes)(f: Expr[Any]): (List[quotes.reflect.ValDef], Expr[R]) = { import quotes.reflect.* - val Block(List(DefDef("$anonfun", List(TermParamClause(params)), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.asTerm.etaExpand(Symbol.spliceOwner) + val Block(List(DefDef("$anonfun", List(TermParamClause(params)), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.asTerm.etaExpand(Symbol.spliceOwner): @unchecked (params, body.asExpr.asInstanceOf[Expr[R]]) } diff --git a/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala index 5aa3a1f700ea..d73a01830259 100644 --- a/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala @@ -83,7 +83,7 @@ object UnsafeExpr { } private def paramsAndBody[R](using Quotes)(f: Expr[Any]): (List[quotes.reflect.ValDef], Expr[R]) = { import quotes.reflect.* - val Block(List(DefDef("$anonfun", List(TermParamClause(params)), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.asTerm.etaExpand(Symbol.spliceOwner) + val Block(List(DefDef("$anonfun", List(TermParamClause(params)), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.asTerm.etaExpand(Symbol.spliceOwner): @unchecked (params, body.asExpr.asInstanceOf[Expr[R]]) } @@ -138,4 +138,4 @@ object Const { } rec(expr.asTerm) } -} \ No newline at end of file +} diff --git a/tests/run-macros/quote-matching-open/Macro_1.scala b/tests/run-macros/quote-matching-open/Macro_1.scala index 94fdf1959e31..32a9d03cba74 100644 --- a/tests/run-macros/quote-matching-open/Macro_1.scala +++ b/tests/run-macros/quote-matching-open/Macro_1.scala @@ -34,7 +34,7 @@ object UnsafeExpr { } private def paramsAndBody[R](using Quotes)(f: Expr[Any]): (List[quotes.reflect.ValDef], Expr[R]) = { import quotes.reflect.* - val Block(List(DefDef("$anonfun", List(TermParamClause(params)), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.asTerm.etaExpand(Symbol.spliceOwner) + val Block(List(DefDef("$anonfun", List(TermParamClause(params)), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.asTerm.etaExpand(Symbol.spliceOwner): @unchecked (params, body.asExpr.asInstanceOf[Expr[R]]) } @@ -48,4 +48,4 @@ object UnsafeExpr { case tree => tree }.transformTerm(e)(Symbol.spliceOwner) } -} \ No newline at end of file +} diff --git a/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala b/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala index 81ec927c3338..6f69e02d4d4b 100644 --- a/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala +++ b/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala @@ -53,7 +53,7 @@ object XmlQuote { } // [a0, ...]: Any* - val Typed(Repeated(args0, _), _) = args.asTerm.underlyingArgument + val Typed(Repeated(args0, _), _) = args.asTerm.underlyingArgument: @unchecked val string = parts.mkString("??") '{new Xml(${Expr(string)}, ${liftListOfAny(args0)})} diff --git a/tests/run-staging/quote-type-matcher.scala b/tests/run-staging/quote-type-matcher.scala index e1d213d98019..34a2b3cbd6fc 100644 --- a/tests/run-staging/quote-type-matcher.scala +++ b/tests/run-staging/quote-type-matcher.scala @@ -5,7 +5,7 @@ import scala.reflect.ClassTag object Test { given Compiler = Compiler.make(this.getClass.getClassLoader) def main(args: Array[String]): Unit = withQuotes { - val '[List[Int]] = Type.of[List[Int]] + val '[List[Int]] = Type.of[List[Int]]: @unchecked Type.of[List[Int]] match case '[List[int]] => diff --git a/tests/run/ReplacementMatching.scala b/tests/run/ReplacementMatching.scala index 846f1c0a0966..b233709a7cae 100644 --- a/tests/run/ReplacementMatching.scala +++ b/tests/run/ReplacementMatching.scala @@ -32,12 +32,12 @@ object Test { def groupsMatching: Unit = { val Date = """(\d+)/(\d+)/(\d+)""".r - for (Regex.Groups(a, b, c) <- Date findFirstMatchIn "1/1/2001 marks the start of the millennium. 31/12/2000 doesn't.") { + for (case Regex.Groups(a, b, c) <- Date findFirstMatchIn "1/1/2001 marks the start of the millennium. 31/12/2000 doesn't.") { assert(a == "1") assert(b == "1") assert(c == "2001") } - for (Regex.Groups(a, b, c) <- (Date findAllIn "1/1/2001 marks the start of the millennium. 31/12/2000 doesn't.").matchData) { + for (case Regex.Groups(a, b, c) <- (Date findAllIn "1/1/2001 marks the start of the millennium. 31/12/2000 doesn't.").matchData) { assert(a == "1" || a == "31") assert(b == "1" || b == "12") assert(c == "2001" || c == "2000") diff --git a/tests/run/case-class-23.scala b/tests/run/case-class-23.scala index 92b719574a34..3a45c323bcee 100644 --- a/tests/run/case-class-23.scala +++ b/tests/run/case-class-23.scala @@ -28,6 +28,6 @@ object Test extends App { val x = new TwentyThree(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23) println(x._23) assert(x.copy(_1 = 1) == x) - val TwentyThree(a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, b) = x + val TwentyThree(a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, b) = x: @unchecked println((a, b)) } diff --git a/tests/run/correct-bind.scala b/tests/run/correct-bind.scala index d0ece2021a14..31b913cab3a0 100644 --- a/tests/run/correct-bind.scala +++ b/tests/run/correct-bind.scala @@ -1,4 +1,4 @@ object Test extends App { - val Array(who, what*) = "first second third" split (" ") + val Array(who, what*) = ("first second third" split (" ")): @unchecked println(what) } diff --git a/tests/run/i1748.scala b/tests/run/i1748.scala index bb3df1336563..872bc8aae245 100644 --- a/tests/run/i1748.scala +++ b/tests/run/i1748.scala @@ -7,8 +7,8 @@ object Test { } def main(args: Array[String]): Unit = { - val q"class $name extends $parent" = new Object + val q"class $name extends $parent" = new Object: @unchecked println(name) println(parent) } -} \ No newline at end of file +} diff --git a/tests/run/i1773.scala b/tests/run/i1773.scala index 82fa0dfb4e74..661546e084c7 100644 --- a/tests/run/i1773.scala +++ b/tests/run/i1773.scala @@ -7,7 +7,7 @@ object Test { } def main(args: Array[String]): Unit = { - val q"class ${name: String} extends ${parent: String}" = new Object + val q"class ${name: String} extends ${parent: String}" = new Object: @unchecked println(name) println(parent) } diff --git a/tests/run/i1779.scala b/tests/run/i1779.scala index e81bc97b62c1..c40231f951c0 100644 --- a/tests/run/i1779.scala +++ b/tests/run/i1779.scala @@ -7,7 +7,7 @@ object Test { } def main(args: Array[String]): Unit = { - val q"class $_ extends $_parent" = new Object + val q"class $_ extends $_parent" = new Object: @unchecked println(_parent) } } diff --git a/tests/run/i5067b.scala b/tests/run/i5067b.scala index cd1f3898cb7e..c7c48bce3fff 100644 --- a/tests/run/i5067b.scala +++ b/tests/run/i5067b.scala @@ -6,7 +6,7 @@ object Test { def unapply[T](x: Any): Option[B[T]] = None } try { - val B(_) = null + val B(_) = null: @unchecked } catch { case e: MatchError => println("match error") } diff --git a/tests/run/i8577a.scala b/tests/run/i8577a.scala index fa9d23cb928a..2fb423c5783a 100644 --- a/tests/run/i8577a.scala +++ b/tests/run/i8577a.scala @@ -10,6 +10,6 @@ extension (inline ctx: Macro.StrCtx) inline def unapplySeq(inline input: Int): O Some(Seq(input)) @main def Test: Unit = - val mac"$x" = 1 + val mac"$x" = 1: @unchecked val y: Int = x assert(x == 1) diff --git a/tests/run/i8577b.scala b/tests/run/i8577b.scala index 91744cf48527..d145597e1a00 100644 --- a/tests/run/i8577b.scala +++ b/tests/run/i8577b.scala @@ -10,6 +10,6 @@ extension (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: U): Some(Seq(input)) @main def Test: Unit = - val mac"$x" = 1 + val mac"$x" = 1: @unchecked val y: Int = x assert(x == 1) diff --git a/tests/run/i8577c.scala b/tests/run/i8577c.scala index e49743306ce4..e84a3ea930b2 100644 --- a/tests/run/i8577c.scala +++ b/tests/run/i8577c.scala @@ -10,6 +10,6 @@ extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq(inline input: T): Some(Seq(input)) @main def Test: Unit = - val mac"$x" = 1 + val mac"$x" = 1: @unchecked val y: Int = x assert(x == 1) diff --git a/tests/run/i8577d.scala b/tests/run/i8577d.scala index 8af8fad7cd56..d747b5854b9d 100644 --- a/tests/run/i8577d.scala +++ b/tests/run/i8577d.scala @@ -10,6 +10,6 @@ extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: Some(Seq(input)) @main def Test: Unit = - val mac"$x" = 1 + val mac"$x" = 1: @unchecked val y: Int = x assert(x == 1) diff --git a/tests/run/i8577e.scala b/tests/run/i8577e.scala index 89d391ded2fd..8cb0e0fefa1c 100644 --- a/tests/run/i8577e.scala +++ b/tests/run/i8577e.scala @@ -10,10 +10,10 @@ extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: Some(Seq(input)) @main def Test: Unit = - val mac"$x" = (1, 2) + val mac"$x" = (1, 2): @unchecked val x2: (Int, Int) = x assert(x == (1, 2)) - val mac"$y" = (1, "a") + val mac"$y" = (1, "a"): @unchecked val y2: (Int, String) = y assert(y == (1, "a")) diff --git a/tests/run/i8577f.scala b/tests/run/i8577f.scala index 6ddaedc7b39f..f69fd81cbd54 100644 --- a/tests/run/i8577f.scala +++ b/tests/run/i8577f.scala @@ -10,6 +10,6 @@ object Macro: extension (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: U): Option[Seq[U]] = Some(Seq(input)) - val mac"$x" = 1 + val mac"$x" = 1: @unchecked val y: Int = x assert(x == 1) diff --git a/tests/run/i8577g.scala b/tests/run/i8577g.scala index ec5019d4c353..9e6be741821b 100644 --- a/tests/run/i8577g.scala +++ b/tests/run/i8577g.scala @@ -10,6 +10,6 @@ extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: Some(Seq(input)) @main def Test: Unit = - val mac"$x" = 1 + val mac"$x" = 1: @unchecked val y: Int = x assert(x == 1) diff --git a/tests/run/i8577h.scala b/tests/run/i8577h.scala index 457c8138d840..26a473700666 100644 --- a/tests/run/i8577h.scala +++ b/tests/run/i8577h.scala @@ -10,6 +10,6 @@ extension [T] (inline ctx: Macro.StrCtx) inline def unapplySeq[U](inline input: Some(Seq(input)) @main def Test: Unit = - val mac"$x" = 1 + val mac"$x" = 1: @unchecked val y: Int = x assert(x == 1) diff --git a/tests/run/iarrays.scala b/tests/run/iarrays.scala index a2e11ef4c387..2e3e6f1ebff1 100644 --- a/tests/run/iarrays.scala +++ b/tests/run/iarrays.scala @@ -59,7 +59,7 @@ object Test extends App { val is = IArray.iterate(0, 4)(_ + 1) assert(reduce(is, 0, _ + _) == 6) - val IArray(1, 2, 3) = xs + val IArray(1, 2, 3) = xs: @unchecked val as: IArray[Any] = IArray(1, "hello") assert(as(as.length - 1) == "hello") diff --git a/tests/run/patmat-bind-typed.scala b/tests/run/patmat-bind-typed.scala index 10de921c5190..065babc8216c 100644 --- a/tests/run/patmat-bind-typed.scala +++ b/tests/run/patmat-bind-typed.scala @@ -1,5 +1,5 @@ object Test { - def f(xs: List[Any]) = for (key @ (dummy: String) <- xs) yield key + def f(xs: List[Any]) = for (case key @ (dummy: String) <- xs) yield key def main(args: Array[String]): Unit = { f("abc" :: Nil) foreach println diff --git a/tests/run/quoted-sematics-1.scala b/tests/run/quoted-sematics-1.scala index 84bf754dbc36..2c6344bfdcfd 100644 --- a/tests/run/quoted-sematics-1.scala +++ b/tests/run/quoted-sematics-1.scala @@ -82,7 +82,7 @@ def typeChecks(g: Gamma)(level: 0 | 1)(term: Term): Option[Type] = yield LambdaType(t, res) case App(fun, arg) => // T-App for - LambdaType(t1, t2) <- typeChecks(g)(level)(fun) + case LambdaType(t1, t2) <- typeChecks(g)(level)(fun) `t1` <- typeChecks(g)(level)(arg) yield t2 case Box(body) if level == 0 => // T-Box @@ -90,16 +90,16 @@ def typeChecks(g: Gamma)(level: 0 | 1)(term: Term): Option[Type] = case Lift(body) if level == 0 => // T-Lift for NatType <- typeChecks(g)(0)(body) yield BoxType(NatType) case Splice(body) if level == 1 => // T-Unbox - for BoxType(t) <- typeChecks(g)(0)(body) yield t + for case BoxType(t) <- typeChecks(g)(0)(body) yield t case Match(scrutinee, pat, thenp, elsep) => // T-Pat for - BoxType(t1) <- typeChecks(g)(0)(scrutinee) + case BoxType(t1) <- typeChecks(g)(0)(scrutinee) delta <- typePatChecks(g, t1)(pat) t <- typeChecks(g ++ delta)(0)(thenp) `t` <- typeChecks(g)(0)(elsep) yield t case Fix(t) if level == 0 => - for LambdaType(t1, t2) <- typeChecks(g)(0)(t) yield t2 // T-Fix + for case LambdaType(t1, t2) <- typeChecks(g)(0)(t) yield t2 // T-Fix case _ => None if res.isEmpty then println(s"Failed to type $term at level $level with environment $g") @@ -132,7 +132,7 @@ def step(level: 0 | 1)(term: Term): Term = else if !isValue(arg) then App(fun, step(level)(arg)) // E-App-2 else // E-Beta assert(level == 0) - val Lambda(name, tpe, body) = fun + val Lambda(name, tpe, body) = fun: @unchecked subst(body, name, arg) case Box(body) if level == 0 => Box(step(1)(body)) // E-Box @@ -147,7 +147,7 @@ def step(level: 0 | 1)(term: Term): Term = case Match(scrutinee, pat, thenp, elsep) if level == 0=> if !isValue(scrutinee) then Match(step(0)(scrutinee), pat, thenp, elsep) // E-Pat else - val Box(s) = scrutinee + val Box(s) = scrutinee: @unchecked matchPat(s, pat) match case Some(subs) => subs(thenp) // E-Pat-Succ case None => elsep // E-Pat-Fail diff --git a/tests/run/t3488.scala b/tests/run/t3488.scala index a8cfa9b808d8..4a10f2f4d1c8 100644 --- a/tests/run/t3488.scala +++ b/tests/run/t3488.scala @@ -1,6 +1,6 @@ object Test extends App { def foo(p: => Unit)(x:Int = 0) = x - println(foo { val List(_*)=List(0); 1 } ()) - println(foo { val List(_*)=List(0); 1 } (1)) + println(foo { val List(_*)=List(0): @unchecked; 1 } ()) + println(foo { val List(_*)=List(0): @unchecked; 1 } (1)) } diff --git a/tests/run/t4709.scala b/tests/run/t4709.scala index 2d9119e33076..5bc17f435838 100644 --- a/tests/run/t4709.scala +++ b/tests/run/t4709.scala @@ -1,5 +1,5 @@ object Test { def main(args: Array[String]): Unit = { - val Seq(1, 2) = LazyList(1, 2) + val Seq(1, 2) = LazyList(1, 2): @unchecked } } diff --git a/tests/run/t5045.scala b/tests/run/t5045.scala index b0c3a4ddc4f4..275dad27ef58 100644 --- a/tests/run/t5045.scala +++ b/tests/run/t5045.scala @@ -15,22 +15,22 @@ object Test extends App { def test(msg: String)(strs: Seq[String]): Unit = println("%40s %s".format(msg, strs mkString " ")) test("extract an exact match") { - val dateP1(y,m,d) = dateStr + val dateP1(y,m,d) = dateStr: @unchecked Seq(List(y,m,d).mkString("-"), dateStr) } test("extract from middle of string") { - val dateP1(y,m,d) = "Tested on "+dateStr+"." + val dateP1(y,m,d) = "Tested on "+dateStr+".": @unchecked Seq(List(y,m,d).mkString("-"), dateStr) } test("extract from middle of string (P2)") { - val dateP2(y,m,d) = "Tested on "+dateStr+"." + val dateP2(y,m,d) = "Tested on "+dateStr+".": @unchecked Seq(List(y,m,d).mkString("-"), dateStr) } test("extract from middle of string (P3)") { - val dateP2(y,m,d) = "Tested on "+dateStr+"." + val dateP2(y,m,d) = "Tested on "+dateStr+".": @unchecked Seq(List(y,m,d).mkString("-"), dateStr) } diff --git a/tests/run/t6406-regextract.scala b/tests/run/t6406-regextract.scala index 18cf28865aba..4d10d3f8775c 100644 --- a/tests/run/t6406-regextract.scala +++ b/tests/run/t6406-regextract.scala @@ -20,10 +20,10 @@ object Test extends App { val t = "Last modified 2011-07-15" val p1 = """(\d\d\d\d)-(\d\d)-(\d\d)""".r val y1: Option[String] = for { - p1(year, month, day) <- p1 findFirstIn t + case p1(year, month, day) <- p1 findFirstIn t } yield year val y2: Option[String] = for { - p1(year, month, day) <- p1 findFirstMatchIn t + case p1(year, month, day) <- p1 findFirstMatchIn t } yield year println(s"$y1 $y2") diff --git a/tests/run/t6646.scala b/tests/run/t6646.scala index b96851077bf9..d1c84455c216 100644 --- a/tests/run/t6646.scala +++ b/tests/run/t6646.scala @@ -8,9 +8,9 @@ object Test { val l = List(PrimaryKey, NoNull, lower) // withFilter must be generated in these - for (option @ NoNull <- l) println("Found " + option) - for (option @ `lower` <- l) println("Found " + option) - for ((`lower`, i) <- l.zipWithIndex) println("Found " + i) + for (case option @ NoNull <- l) println("Found " + option) + for (case option @ `lower` <- l) println("Found " + option) + for (case (`lower`, i) <- l.zipWithIndex) println("Found " + i) // no withFilter for (X <- List("A single ident is always a pattern")) println(X) diff --git a/tests/run/t6968.scala b/tests/run/t6968.scala index c4e47ba0eda8..84a0969c0872 100644 --- a/tests/run/t6968.scala +++ b/tests/run/t6968.scala @@ -1,7 +1,7 @@ object Test { def main(args: Array[String]): Unit = { val mixedList = List(1,(1,2),4,(3,1),(5,4),6) - val as = for((a,b) <- mixedList) yield a + val as = for(case (a,b) <- mixedList) yield a println(as.mkString(", ")) } } diff --git a/tests/run/t8395.scala b/tests/run/t8395.scala index f2b687e2b561..6658771aa3ba 100644 --- a/tests/run/t8395.scala +++ b/tests/run/t8395.scala @@ -1,6 +1,6 @@ object Test { def baz(x: Object) = { - val s @ (_s: String) = x + val s @ (_s: String) = x: @unchecked x } def main(args: Array[String]): Unit = { diff --git a/tests/run/trailingCommas.scala b/tests/run/trailingCommas.scala index 319737b0e299..e70050cba32b 100644 --- a/tests/run/trailingCommas.scala +++ b/tests/run/trailingCommas.scala @@ -1,6 +1,6 @@ object Test { val List(x, y, z: _ *, - ) = 42 :: 17 :: Nil + ) = 42 :: 17 :: Nil: @unchecked def main(args: Array[String]): Unit = { Console.println(x) Console.println(y) diff --git a/tests/run/tuple-accessors.scala b/tests/run/tuple-accessors.scala index 0931babf00a8..189db457ece1 100644 --- a/tests/run/tuple-accessors.scala +++ b/tests/run/tuple-accessors.scala @@ -51,10 +51,10 @@ object Test { def any = { val x: Any = null - val X2(a2, b2) = x - val X3(a3, b3, c3) = x - val X4(a4, b4, c4, d4) = x - val X5(a5, b5, c5, d5, e5) = x - val X6(a6, b6, c6, d6, e6, f6) = x + val X2(a2, b2) = x: @unchecked + val X3(a3, b3, c3) = x: @unchecked + val X4(a4, b4, c4, d4) = x: @unchecked + val X5(a5, b5, c5, d5, e5) = x: @unchecked + val X6(a6, b6, c6, d6, e6, f6) = x: @unchecked } } diff --git a/tests/run/tuple-patmat-extract.scala b/tests/run/tuple-patmat-extract.scala index e5f420717e1b..d3438e7cb741 100644 --- a/tests/run/tuple-patmat-extract.scala +++ b/tests/run/tuple-patmat-extract.scala @@ -1,7 +1,7 @@ object Test { def main(args: Array[String]): Unit = { val Const, x = 0 - val (Const, List(`x`, _, a), b) = (0, List(0, 1337, 1), 2) + val (Const, List(`x`, _, a), b) = (0, List(0, 1337, 1), 2): @unchecked val (_, (c, _)) = (2, (3, 4)) assert(a == 1) @@ -9,36 +9,36 @@ object Test { assert(c == 3) val (Const, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, List(`x`, _, a21), b21) = - (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, List(0, 1337, 1), 2) + (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, List(0, 1337, 1), 2): @unchecked val (_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, c21, _)) = - (2, (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4)) + (2, (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4)): @unchecked assert(a21 == 1) assert(b21 == 2) assert(c21 == 3) val (Const, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, List(`x`, _, a22), b22) = - (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, List(0, 1337, 1), 2) + (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, List(0, 1337, 1), 2): @unchecked val (_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, c22, _)) = - (2, (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4)) + (2, (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4)): @unchecked assert(a22 == 1) assert(b22 == 2) assert(c22 == 3) val (Const, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, List(`x`, _, a23), b23) = - (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, List(0, 1337, 1), 2) + (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, List(0, 1337, 1), 2): @unchecked val (_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, c23, _)) = - (2, (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4)) + (2, (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4)): @unchecked assert(a23 == 1) assert(b23 == 2) assert(c23 == 3) val (Const, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, List(`x`, _, a24), b24) = - (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, List(0, 1337, 1), 2) + (0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, List(0, 1337, 1), 2): @unchecked val (_, (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, c24, _)) = - (2, (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4)) + (2, (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4)): @unchecked assert(a24 == 1) assert(b24 == 2)