diff --git a/tests/neg/rewrite-messages.scala b/tests/neg/rewrite-messages.scala deleted file mode 100644 index 25eeea997b8f..000000000000 --- a/tests/neg/rewrite-messages.scala +++ /dev/null @@ -1,9 +0,0 @@ -//> using options -source:future-migration -deprecation -Werror - -import scala.util._ // warn - -object Test { - extension (x: Int) def foo(y: Int) = x + y - 2 foo 4 // warn -} -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/with-type-operator-future-migration.scala b/tests/neg/with-type-operator-future-migration.scala deleted file mode 100644 index dac924603636..000000000000 --- a/tests/neg/with-type-operator-future-migration.scala +++ /dev/null @@ -1,7 +0,0 @@ -//> using options -Werror - -import scala.language.`future-migration` - -def foo: Int with String = ??? // warn - -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/15981.scala b/tests/warn/15981.scala similarity index 63% rename from tests/neg/15981.scala rename to tests/warn/15981.scala index fe8c2d3bd2cc..a52da28c8462 100644 --- a/tests/neg/15981.scala +++ b/tests/warn/15981.scala @@ -1,7 +1,6 @@ -//> using options -Werror + val _ = locally{ sealed abstract class PosInt(val value: Int) { override def equals(any: Any): Boolean = any.isInstanceOf[PosInt] // warn } } -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/17284.scala b/tests/warn/17284.scala similarity index 57% rename from tests/neg/17284.scala rename to tests/warn/17284.scala index 5b99fd140193..c30e8cb478ec 100644 --- a/tests/neg/17284.scala +++ b/tests/warn/17284.scala @@ -1,4 +1,4 @@ -//> using options -Werror -explain +//> using options -explain def test = 451.synchronized {} // warn @@ -11,5 +11,4 @@ def test3 = true.synchronized {} // warn def test4 = - true.hashCode() // success -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + true.hashCode() // success \ No newline at end of file diff --git a/tests/neg/18493.scala b/tests/warn/18493.scala similarity index 72% rename from tests/neg/18493.scala rename to tests/warn/18493.scala index 006c275aa7fc..d3ca292a346e 100644 --- a/tests/neg/18493.scala +++ b/tests/warn/18493.scala @@ -1,4 +1,4 @@ -//> using options -Werror + object PartialFunctionNoWarning { // nice warning "abc" match { @@ -11,5 +11,4 @@ object PartialFunctionNoWarning { case "abc" => case "abc" => // warn } -} -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +} \ No newline at end of file diff --git a/tests/neg/i15503i.scala b/tests/warn/i15503i.scala similarity index 98% rename from tests/neg/i15503i.scala rename to tests/warn/i15503i.scala index ff33e7cbb0c2..329b81327288 100644 --- a/tests/neg/i15503i.scala +++ b/tests/warn/i15503i.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:all +//> using options -Wunused:all import collection.mutable.{Map => MutMap} // warn import collection.mutable.Set // warn @@ -312,5 +312,4 @@ package foo.test.i17117: val test = t1.test } - } -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + } \ No newline at end of file diff --git a/tests/neg/i15893.scala b/tests/warn/i15893.scala similarity index 95% rename from tests/neg/i15893.scala rename to tests/warn/i15893.scala index 79908e1e8615..3ae52cb05868 100644 --- a/tests/neg/i15893.scala +++ b/tests/warn/i15893.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + sealed trait NatT case class Zero() extends NatT @@ -60,5 +60,4 @@ inline def transparentInlineFoo(inline n: NatT): NatT = inline transparentInline println(transparentInlineFoo(Succ(Succ(Succ(Zero()))))) // prints Zero(), as expected println(dependentlyTypedMod2(Succ(Succ(Succ(Zero()))))) // runtime error; unexpected println(inlineDependentlyTypedMod2(Succ(Succ(Succ(Zero()))))) // prints Succ(Zero()), as expected - println(transparentInlineDependentlyTypedMod2(Succ(Succ(Succ(Zero()))))) // prints Succ(Zero()), as expected -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + println(transparentInlineDependentlyTypedMod2(Succ(Succ(Succ(Zero()))))) // prints Succ(Zero()), as expected \ No newline at end of file diff --git a/tests/neg/i17266.scala b/tests/warn/i17266.scala similarity index 93% rename from tests/neg/i17266.scala rename to tests/warn/i17266.scala index 23ed825e285c..7e0c9f1b653b 100644 --- a/tests/neg/i17266.scala +++ b/tests/warn/i17266.scala @@ -1,4 +1,4 @@ -//> using options -Werror -explain +//> using options -explain def test1 = synchronized { // warn @@ -141,5 +141,4 @@ def test26 = hashCode() // warn def test27 = - 1.hashCode()// not an error (should be? probably not) -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + 1.hashCode()// not an error (should be? probably not) \ No newline at end of file diff --git a/tests/neg/i18722.scala b/tests/warn/i18722.scala similarity index 55% rename from tests/neg/i18722.scala rename to tests/warn/i18722.scala index 1c32aae3ae26..246640a349b4 100644 --- a/tests/neg/i18722.scala +++ b/tests/warn/i18722.scala @@ -1,4 +1,4 @@ -//> using options -Werror -explain +//> using options -explain def f1: Unit = null // warn def f2: Unit = 1 // warn @@ -6,5 +6,4 @@ def f3: Unit = "a" // warn val i: Int = 1 def f4: Unit = i // warn val u: Unit = () -def f5: Unit = u -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +def f5: Unit = u \ No newline at end of file diff --git a/tests/neg/i4812.scala b/tests/warn/i4812.scala similarity index 95% rename from tests/neg/i4812.scala rename to tests/warn/i4812.scala index a2fcd87a134c..e396098faa93 100644 --- a/tests/neg/i4812.scala +++ b/tests/warn/i4812.scala @@ -1,4 +1,4 @@ -//> using options -Werror + object Test: var prev: Any = _ @@ -116,5 +116,4 @@ object Test: def main(args: Array[String]): Unit = test(1) - val x: String = test("") // was: ClassCastException: java.lang.Integer cannot be cast to java.lang.String -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + val x: String = test("") // was: ClassCastException: java.lang.Integer cannot be cast to java.lang.String \ No newline at end of file diff --git a/tests/neg/i5077.scala b/tests/warn/i5077.scala similarity index 89% rename from tests/neg/i5077.scala rename to tests/warn/i5077.scala index 7ea64acf5fb1..555d972382d2 100644 --- a/tests/neg/i5077.scala +++ b/tests/warn/i5077.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wimplausible-patterns +//> using options -Wimplausible-patterns trait Is[A] case object IsInt extends Is[Int] case object IsString extends Is[String] @@ -30,5 +30,4 @@ def Test = { case C(IsString, s) => println(s"A String with length ${s.length}") case _ => println("No match") } -} -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +} \ No newline at end of file diff --git a/tests/neg/refutable-pattern-binding-messages.scala b/tests/warn/refutable-pattern-binding-messages.scala similarity index 88% rename from tests/neg/refutable-pattern-binding-messages.scala rename to tests/warn/refutable-pattern-binding-messages.scala index bdbacdfa9c03..41aa24787389 100644 --- a/tests/neg/refutable-pattern-binding-messages.scala +++ b/tests/warn/refutable-pattern-binding-messages.scala @@ -1,4 +1,4 @@ -//> using options -Werror + object Test { // refutable extractor object Positive { def unapply(i: Int): Option[Int] = Some(i).filter(_ > 0) } @@ -14,5 +14,4 @@ object Test { val ys: List[Option[?]] = ??? for none @ None <- ys do () // warn: pattern type does not match val 1 = 2 // warn: pattern type does not match -} -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +} \ No newline at end of file diff --git a/tests/warn/rewrite-messages.scala b/tests/warn/rewrite-messages.scala new file mode 100644 index 000000000000..88166f8e8ac2 --- /dev/null +++ b/tests/warn/rewrite-messages.scala @@ -0,0 +1,8 @@ +//> using options -source:future-migration -deprecation + +import scala.util._ // warn + +object Test { + extension (x: Int) def foo(y: Int) = x + y + 2 foo 4 // warn +} \ No newline at end of file diff --git a/tests/neg/warn-value-discard.scala b/tests/warn/warn-value-discard.scala similarity index 94% rename from tests/neg/warn-value-discard.scala rename to tests/warn/warn-value-discard.scala index 5bfb81b2fb65..8bb9aebf515b 100644 --- a/tests/neg/warn-value-discard.scala +++ b/tests/warn/warn-value-discard.scala @@ -1,4 +1,4 @@ -//> using options -Wvalue-discard -Werror +//> using options -Wvalue-discard import scala.util.{Either, Right, Left} import scala.collection.mutable @@ -63,5 +63,4 @@ class ValueDiscardTest: // - receiver is a local variable // --> No warning val s: mutable.Set[String] = mutable.Set.empty[String] - s += "" -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + s += "" \ No newline at end of file diff --git a/tests/warn/with-type-operator-future-migration.scala b/tests/warn/with-type-operator-future-migration.scala new file mode 100644 index 000000000000..42b029665565 --- /dev/null +++ b/tests/warn/with-type-operator-future-migration.scala @@ -0,0 +1,6 @@ + + +import scala.language.`future-migration` + +def foo: Int with String = ??? // warn +