From 78adb39af99bb89bac3988c58a9e177edba1f3e5 Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Fri, 15 Dec 2023 16:39:17 +0100 Subject: [PATCH] Third batch of neg -> warn test changes --- .../dotty/tools/dotc/CompilationTests.scala | 3 + tests/init-global/{neg => warn}/i18628.scala | 2 +- .../init-global/{neg => warn}/i18628_2.scala | 2 +- .../init-global/{neg => warn}/i18628_3.scala | 2 +- tests/neg-custom-args/sourcepath2/hi/A.check | 5 +- tests/neg-custom-args/sourcepath2/hi/A.scala | 3 +- tests/neg-deep-subtype/1828.scala | 11 ---- tests/neg-deep-subtype/3324b.scala | 11 ---- tests/neg-deep-subtype/3324f.scala | 11 ---- tests/neg-deep-subtype/3324g.scala | 21 ------- tests/neg-deep-subtype/JavaSeqLiteral.scala | 31 ---------- .../conditionalWarnings.scala | 15 ----- tests/neg-deep-subtype/gadt.scala | 15 ----- tests/neg-deep-subtype/html.scala | 20 ------- tests/neg-deep-subtype/i3324.scala | 6 -- tests/neg-deep-subtype/i4297.scala | 13 ---- tests/neg-deep-subtype/or-type-trees.scala | 40 ------------- tests/neg-deep-subtype/refined-types.scala | 24 -------- tests/neg-deep-subtype/t2755.scala | 60 ------------------- tests/neg-deep-subtype/type-lambda.scala | 16 ----- tests/neg-macros/i9570.check | 5 ++ tests/neg-macros/i9570.scala | 6 +- tests/neg-macros/macro-deprecation.check | 5 ++ tests/neg-macros/macro-deprecation.scala | 4 +- tests/neg-scalajs/enumeration-warnings.check | 49 +++++++-------- tests/neg-scalajs/enumeration-warnings.scala | 26 ++++---- tests/patmat/i14407.dupe.check | 1 + tests/patmat/i18118.check | 1 + 28 files changed, 69 insertions(+), 339 deletions(-) rename tests/init-global/{neg => warn}/i18628.scala (69%) rename tests/init-global/{neg => warn}/i18628_2.scala (73%) rename tests/init-global/{neg => warn}/i18628_3.scala (67%) delete mode 100644 tests/neg-deep-subtype/1828.scala delete mode 100644 tests/neg-deep-subtype/3324b.scala delete mode 100644 tests/neg-deep-subtype/3324f.scala delete mode 100644 tests/neg-deep-subtype/3324g.scala delete mode 100644 tests/neg-deep-subtype/JavaSeqLiteral.scala delete mode 100644 tests/neg-deep-subtype/conditionalWarnings.scala delete mode 100644 tests/neg-deep-subtype/gadt.scala delete mode 100644 tests/neg-deep-subtype/html.scala delete mode 100644 tests/neg-deep-subtype/i3324.scala delete mode 100644 tests/neg-deep-subtype/i4297.scala delete mode 100644 tests/neg-deep-subtype/or-type-trees.scala delete mode 100644 tests/neg-deep-subtype/refined-types.scala delete mode 100644 tests/neg-deep-subtype/t2755.scala delete mode 100644 tests/neg-deep-subtype/type-lambda.scala create mode 100644 tests/neg-macros/i9570.check create mode 100644 tests/neg-macros/macro-deprecation.check diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 4f1a64bbc6fa..7af43295814d 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -216,7 +216,10 @@ class CompilationTests { @Test def checkInitGlobal: Unit = { implicit val testGroup: TestGroup = TestGroup("checkInitGlobal") val options = defaultOptions.and("-Ysafe-init-global", "-Xfatal-warnings") + compileFilesInDir("tests/init-global/neg", options).checkExpectedErrors() + compileFilesInDir("tests/init-global/pos", options).checkCompile() compileFilesInDir("tests/init-global/neg", options, FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkExpectedErrors() + compileFilesInDir("tests/init-global/warn", defaultOptions.and("-Ysafe-init-global"), FileFilter.exclude(TestSources.negInitGlobalScala2LibraryTastyBlacklisted)).checkWarnings() compileFilesInDir("tests/init-global/pos", options, FileFilter.exclude(TestSources.posInitGlobalScala2LibraryTastyBlacklisted)).checkCompile() } diff --git a/tests/init-global/neg/i18628.scala b/tests/init-global/warn/i18628.scala similarity index 69% rename from tests/init-global/neg/i18628.scala rename to tests/init-global/warn/i18628.scala index 798b3204338c..afd5c14d0b7d 100644 --- a/tests/init-global/neg/i18628.scala +++ b/tests/init-global/warn/i18628.scala @@ -2,6 +2,6 @@ object Test: class Box(val x: Int) def recur(a: => Box, b: => Box): Int = - a.x + recur(a, b) + b.x // error // error + a.x + recur(a, b) + b.x // warn // warn recur(Box(1), Box(2)) \ No newline at end of file diff --git a/tests/init-global/neg/i18628_2.scala b/tests/init-global/warn/i18628_2.scala similarity index 73% rename from tests/init-global/neg/i18628_2.scala rename to tests/init-global/warn/i18628_2.scala index 4ad428035441..7f90f51ccc1a 100644 --- a/tests/init-global/neg/i18628_2.scala +++ b/tests/init-global/warn/i18628_2.scala @@ -2,6 +2,6 @@ object Test: class Box(val x: Int) def recur(a: => Box, b: Box): Int = - a.x + recur(a, b) + b.x // error + a.x + recur(a, b) + b.x // warn recur(Box(1), Box(2)) diff --git a/tests/init-global/neg/i18628_3.scala b/tests/init-global/warn/i18628_3.scala similarity index 67% rename from tests/init-global/neg/i18628_3.scala rename to tests/init-global/warn/i18628_3.scala index 101674cffb6f..0a14c7d4c73e 100644 --- a/tests/init-global/neg/i18628_3.scala +++ b/tests/init-global/warn/i18628_3.scala @@ -4,6 +4,6 @@ object Test: class Box(val x: Int) def recur(a: => Box, b: => Box): Int = - a.x + recur(a: @widen(5), b: @widen(5)) + b.x // error // error + a.x + recur(a: @widen(5), b: @widen(5)) + b.x // warn // warn recur(Box(1), Box(2)) \ No newline at end of file diff --git a/tests/neg-custom-args/sourcepath2/hi/A.check b/tests/neg-custom-args/sourcepath2/hi/A.check index 61d4798a34e7..1fac6b1147ef 100644 --- a/tests/neg-custom-args/sourcepath2/hi/A.check +++ b/tests/neg-custom-args/sourcepath2/hi/A.check @@ -1,6 +1,7 @@ --- Error: tests/neg-custom-args/sourcepath2/hi/A.scala:3:6 ------------------------------------------------------------- -3 |class Hello { // error +-- Warning: tests/neg-custom-args/sourcepath2/hi/A.scala:3:6 ----------------------------------------------------------- +3 |class Hello { // warn | ^ | class Hello is in the wrong directory. | It was declared to be in package | But it is found in directory hi +No warnings can be incurred under -Werror. diff --git a/tests/neg-custom-args/sourcepath2/hi/A.scala b/tests/neg-custom-args/sourcepath2/hi/A.scala index c332f2494e15..039910e55ce7 100644 --- a/tests/neg-custom-args/sourcepath2/hi/A.scala +++ b/tests/neg-custom-args/sourcepath2/hi/A.scala @@ -1,5 +1,6 @@ // Missing `package hi` -class Hello { // error +class Hello { // warn val x: Int = 1 } +// nopos-error: werror \ No newline at end of file diff --git a/tests/neg-deep-subtype/1828.scala b/tests/neg-deep-subtype/1828.scala deleted file mode 100644 index ae228a83e898..000000000000 --- a/tests/neg-deep-subtype/1828.scala +++ /dev/null @@ -1,11 +0,0 @@ -//> using options -Xfatal-warnings - -class Test { - def remove[S](a: S | Int, f: Int => S):S = a match { - case a: S => a // error - case a: Int => f(a) - } - - val t: Int | String = 5 - val t1 = remove[String](t, _.toString) -} diff --git a/tests/neg-deep-subtype/3324b.scala b/tests/neg-deep-subtype/3324b.scala deleted file mode 100644 index df0cc5432eff..000000000000 --- a/tests/neg-deep-subtype/3324b.scala +++ /dev/null @@ -1,11 +0,0 @@ -//> using options -Xfatal-warnings - -class C[T] { - val x: Any = ??? - if (x.isInstanceOf[List[String]]) // error: unchecked - if (x.isInstanceOf[T]) // error: unchecked - x match { - case x: List[String] => // error: unchecked - case x: T => // error: unchecked - } -} diff --git a/tests/neg-deep-subtype/3324f.scala b/tests/neg-deep-subtype/3324f.scala deleted file mode 100644 index 445da5cb25a0..000000000000 --- a/tests/neg-deep-subtype/3324f.scala +++ /dev/null @@ -1,11 +0,0 @@ -//> using options -Xfatal-warnings - -trait C[T] -class D[T] - -class Test { - def foo[T](x: C[T]) = x match { - case _: D[T] => // error - case _: C[Int] => // error - } -} \ No newline at end of file diff --git a/tests/neg-deep-subtype/3324g.scala b/tests/neg-deep-subtype/3324g.scala deleted file mode 100644 index a5b842e4e450..000000000000 --- a/tests/neg-deep-subtype/3324g.scala +++ /dev/null @@ -1,21 +0,0 @@ -//> using options -Xfatal-warnings - -class Test { - trait A[+T] - class B[T] extends A[T] - class C[T] extends B[Any] with A[T] - - def foo[T](c: C[T]): Unit = c match { - case _: B[T] => // error - } - - def bar[T](b: B[T]): Unit = b match { - case _: A[T] => - } - - def quux[T](a: A[T]): Unit = a match { - case _: B[T] => // error!! - } - - quux(new C[Int]) -} diff --git a/tests/neg-deep-subtype/JavaSeqLiteral.scala b/tests/neg-deep-subtype/JavaSeqLiteral.scala deleted file mode 100644 index 6003731ae657..000000000000 --- a/tests/neg-deep-subtype/JavaSeqLiteral.scala +++ /dev/null @@ -1,31 +0,0 @@ -//> using options -Xfatal-warnings - -object Test1 { - trait Tree[-T] - - class JavaSeqLiteral[T] extends Tree[T] - - trait Type - - class DummyTree extends JavaSeqLiteral[Any] - - def foo1(tree: Tree[Type]) = - tree.isInstanceOf[JavaSeqLiteral[Type]] // error - - foo1(new DummyTree) -} - -object Test2 { - trait Tree[-T] - - class JavaSeqLiteral[-T] extends Tree[T] - - trait Type - - class DummyTree extends JavaSeqLiteral[Any] - - def foo1(tree: Tree[Type]) = - tree.isInstanceOf[JavaSeqLiteral[Type]] - - foo1(new DummyTree) -} \ No newline at end of file diff --git a/tests/neg-deep-subtype/conditionalWarnings.scala b/tests/neg-deep-subtype/conditionalWarnings.scala deleted file mode 100644 index c4757cbb7546..000000000000 --- a/tests/neg-deep-subtype/conditionalWarnings.scala +++ /dev/null @@ -1,15 +0,0 @@ -//> using options -deprecation -Xfatal-warnings - -object Test { - @deprecated def foo = ??? - - given Conversion[String, Int] = _.length - - foo // error - - val x: Int = "abc" - // OK, since -feature warnings are not enabled. - // The program compiles with final line - // there was 1 feature warning; re-run with -feature for details - // nopos-error -} diff --git a/tests/neg-deep-subtype/gadt.scala b/tests/neg-deep-subtype/gadt.scala deleted file mode 100644 index 661c04fef373..000000000000 --- a/tests/neg-deep-subtype/gadt.scala +++ /dev/null @@ -1,15 +0,0 @@ -//> using options -Xfatal-warnings - -class Test { - trait A[+T] - class B[T] extends A[T] - - class C - class D extends C - - def quux(a: A[C]): Unit = a match { - case _: B[C] => // error!! - } - - quux(new B[D]) -} \ No newline at end of file diff --git a/tests/neg-deep-subtype/html.scala b/tests/neg-deep-subtype/html.scala deleted file mode 100644 index f17cfb661505..000000000000 --- a/tests/neg-deep-subtype/html.scala +++ /dev/null @@ -1,20 +0,0 @@ -//> using options -Xfatal-warnings - -object HTML: - type AttrArg = AppliedAttr | Seq[AppliedAttr] - opaque type AppliedAttr = String - opaque type AppliedTag = StringBuilder - - case class Tag(name: String): - def apply(attrs: AttrArg*): AppliedTag = { - val sb = StringBuilder() - sb.append(s"<$name") - attrs.filter(_ != Nil).foreach{ - case s: Seq[AppliedAttr] => - s.foreach(sb.append(" ").append) - case s: Seq[Int] => // error - case e: AppliedAttr => - sb.append(" ").append(e) - } - sb - } diff --git a/tests/neg-deep-subtype/i3324.scala b/tests/neg-deep-subtype/i3324.scala deleted file mode 100644 index 9b1060836430..000000000000 --- a/tests/neg-deep-subtype/i3324.scala +++ /dev/null @@ -1,6 +0,0 @@ -//> using options -Xfatal-warnings - -class Foo { - def foo(x: Any): Boolean = - x.isInstanceOf[List[String]] // error -} diff --git a/tests/neg-deep-subtype/i4297.scala b/tests/neg-deep-subtype/i4297.scala deleted file mode 100644 index 88e66c59d1b4..000000000000 --- a/tests/neg-deep-subtype/i4297.scala +++ /dev/null @@ -1,13 +0,0 @@ -//> using options -Xfatal-warnings - -class Test { - def test[X <: Option[Int]](x: X) = x.isInstanceOf[Some[Int]] - def test1[Y <: Int, X <: Option[Y]](x: X) = x.isInstanceOf[Some[Int]] - def test2(x: Any) = x.isInstanceOf[Function1[Nothing, ?]] - def test3a(x: Any) = x.isInstanceOf[Function1[Any, ?]] // error - def test3b(x: Any) = x.isInstanceOf[Function1[Int, ?]] // error - def test4[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[Int, ?]] // error - def test5[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[Int, Unit]] // error - def test6[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[Int, Any]] // error - def test7[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[?, Unit]] -} diff --git a/tests/neg-deep-subtype/or-type-trees.scala b/tests/neg-deep-subtype/or-type-trees.scala deleted file mode 100644 index d0338ffe6066..000000000000 --- a/tests/neg-deep-subtype/or-type-trees.scala +++ /dev/null @@ -1,40 +0,0 @@ -//> using options -Xfatal-warnings - -object Test1 { - trait Tree - trait Context - - def foo1(myTree: Tree | (Context => Tree)) = - println(myTree.isInstanceOf[Tree]) - - def foo2(myTree: Tree | (Context => Tree)) = - myTree match - case treeFn: (Context => Tree) => // error - case _ => - - def foo3(myTree: Tree | (Context => Tree)) = - myTree match - case treeFn: (? => ?) => // ok - case _ => -} - -object Test2 { - trait Tree[-T] - trait Context - - trait Type - - def foo1(myTree: Tree[Type] | (Context => Tree[Type])) = - println(myTree.isInstanceOf[Tree[Type]]) // error - /* class DummyTree extends Tree[Nothing] with (Context => Tree[Type]) */ - - def foo2(myTree: Tree[Type] | (Context => Tree[Type])) = - myTree match - case treeFn: (Context => Tree[Type]) => // error - case _ => - - def foo3(myTree: Tree[Type] | (Context => Tree[Type])) = - myTree match - case treeFn: (? => ?) => // ok - case _ => -} \ No newline at end of file diff --git a/tests/neg-deep-subtype/refined-types.scala b/tests/neg-deep-subtype/refined-types.scala deleted file mode 100644 index 5f5cc5a45f04..000000000000 --- a/tests/neg-deep-subtype/refined-types.scala +++ /dev/null @@ -1,24 +0,0 @@ -//> using options -Xfatal-warnings - -class A -class B extends A -type AA = A { type T = Int } -type BA = B { type T = Int } -type AL = A { type T >: Int } -type BL = B { type T >: Int } -type AU = A { type T <: Int } -type BU = B { type T <: Int } - -def aa(x: AA) = x.isInstanceOf[BA] // was: the type test for BA cannot be checked at runtime -def al(x: AL) = x.isInstanceOf[BL] // was: the type test for BL cannot be checked at runtime -def au(x: AU) = x.isInstanceOf[BU] // was: the type test for BU cannot be checked at runtime - -// an alias leaves nothing unchecked when type testing against one bound: -def bl(x: AA) = x.isInstanceOf[BL] // was: the type test for BL cannot be checked at runtime -def bu(x: AA) = x.isInstanceOf[BU] // was: the type test for BU cannot be checked at runtime - -// but static knowledge of only one bound makes checking against an alias unchecked: -def al_ba(x: AL) = x.isInstanceOf[BA] // error: the type test for BA cannot be checked at runtime -def au_ba(x: AU) = x.isInstanceOf[BA] // error: the type test for BA cannot be checked at runtime -def al_bu(x: AL) = x.isInstanceOf[BU] // error: the type test for BU cannot be checked at runtime -def au_bl(x: AU) = x.isInstanceOf[BL] // error: the type test for BL cannot be checked at runtime diff --git a/tests/neg-deep-subtype/t2755.scala b/tests/neg-deep-subtype/t2755.scala deleted file mode 100644 index ec3cb6aadefc..000000000000 --- a/tests/neg-deep-subtype/t2755.scala +++ /dev/null @@ -1,60 +0,0 @@ -//> using options -Xfatal-warnings - -// Test cases: the only place we can cut and paste without crying -// ourself to sleep. -object Test { - def f1(a: Any) = a match { - case x: Array[Int] => x(0) - case x: Array[Double] => 2 - case x: Array[Float] => x.sum.toInt - case x: Array[String] => x.size - case x: Array[AnyRef] => 5 - case x: Array[?] => 6 - case _ => 7 - } - def f2(a: Array[?]) = a match { - case x: Array[Int] => x(0) - case x: Array[Double] => 2 - case x: Array[Float] => x.sum.toInt - case x: Array[String] => x.size - case x: Array[AnyRef] => 5 - case x: Array[?] => 6 - case _ => 7 // error: only null is matched - } - def f3[T](a: Array[T]) = a match { - case x: Array[Int] => x(0) - case x: Array[Double] => 2 - case x: Array[Float] => x.sum.toInt - case x: Array[String] => x.size - case x: Array[AnyRef] => 5 - case x: Array[?] => 6 - case _ => 7 // error: only null is matched - } - - - def main(args: Array[String]): Unit = { - println(f1(Array(1, 2, 3))) - println(f1(Array(1.0, -2.0, 3.0, 1.0))) - println(f1(Array(1.0f, 2.0f, 3.0f, -3.0f))) - println(f1((1 to 4).toArray map (_.toString))) - println(f1(new Array[Any](10))) // should match as Array[AnyRef] - println(f1(Array(1L))) - println(f1(null)) - - println(f2(Array(1, 2, 3))) - println(f2(Array(1.0, -2.0, 3.0, 1.0))) - println(f2(Array(1.0f, 2.0f, 3.0f, -3.0f))) - println(f2((1 to 4).toArray map (_.toString))) - println(f2(new Array[Any](10))) // should match as Array[AnyRef] - println(f2(Array(1L))) - println(f2(null)) - - println(f3(Array(1, 2, 3))) - println(f3(Array(1.0, -2.0, 3.0, 1.0))) - println(f3(Array(1.0f, 2.0f, 3.0f, -3.0f))) - println(f3((1 to 4).toArray map (_.toString))) - println(f3(new Array[Any](10))) // should match as Array[AnyRef] - println(f3(Array(1L))) - println(f3(null)) - } -} diff --git a/tests/neg-deep-subtype/type-lambda.scala b/tests/neg-deep-subtype/type-lambda.scala deleted file mode 100644 index 4c4627fe1cf3..000000000000 --- a/tests/neg-deep-subtype/type-lambda.scala +++ /dev/null @@ -1,16 +0,0 @@ -//> using options -Xfatal-warnings - -trait A[T] -trait B[T] extends A[T] - -object Test { - def foo(x: ([X] =>> A[X])[Any]) = x match { - case x: ([X] =>> B[X])[Any] => - case _ => - } - - def bar(x: ([X] =>> A[X])[Any]) = x match { - case x: ([X] =>> B[Nothing])[Any] => // error - case _ => - } -} diff --git a/tests/neg-macros/i9570.check b/tests/neg-macros/i9570.check new file mode 100644 index 000000000000..16b71d317b7c --- /dev/null +++ b/tests/neg-macros/i9570.check @@ -0,0 +1,5 @@ +-- Warning: tests/neg-macros/i9570.scala:15:21 ------------------------------------------------------------------------- +15 | case '{HCons(_,$t)} => // warn (in .check file) + | ^ + | Use of `_` for lambda in quoted pattern. Use explicit lambda instead or use `$_` to match any term. +No warnings can be incurred under -Werror. diff --git a/tests/neg-macros/i9570.scala b/tests/neg-macros/i9570.scala index 9242fd2e9bbd..0c67c2d0f8d1 100644 --- a/tests/neg-macros/i9570.scala +++ b/tests/neg-macros/i9570.scala @@ -12,7 +12,7 @@ object Macros { private def sizeImpl(e: Expr[HList], n:Int)(using qctx:Quotes): Expr[Int] = { import quotes.reflect.* e match { - case '{HCons(_,$t)} => // error if run with fatal warinings in BootstrappedOnlyCompilationTests + case '{HCons(_,$t)} => // warn (in .check file) sizeImpl(t,n+1) case '{HNil} => Expr(n) } @@ -20,7 +20,9 @@ object Macros { inline def size(inline expr: HList ): Int = { ${sizeImpl('expr,0)} - } + } } } + +// nopos-error No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-macros/macro-deprecation.check b/tests/neg-macros/macro-deprecation.check new file mode 100644 index 000000000000..5ce8a2427127 --- /dev/null +++ b/tests/neg-macros/macro-deprecation.check @@ -0,0 +1,5 @@ +-- Deprecation Warning: tests/neg-macros/macro-deprecation.scala:5:18 -------------------------------------------------- +5 |inline def f = ${ impl } // warn (in .check file) + | ^^^^ + | method impl is deprecated +No warnings can be incurred under -Werror. diff --git a/tests/neg-macros/macro-deprecation.scala b/tests/neg-macros/macro-deprecation.scala index ad1cdda001bb..0bbf4d5faa1e 100644 --- a/tests/neg-macros/macro-deprecation.scala +++ b/tests/neg-macros/macro-deprecation.scala @@ -2,5 +2,7 @@ import scala.quoted.* -inline def f = ${ impl } // error +inline def f = ${ impl } // warn (in .check file) @deprecated def impl(using Quotes) = '{1} + +// nopos-error No warnings can be incurred under -Werror. diff --git a/tests/neg-scalajs/enumeration-warnings.check b/tests/neg-scalajs/enumeration-warnings.check index b356a150daa5..5d791be5928a 100644 --- a/tests/neg-scalajs/enumeration-warnings.check +++ b/tests/neg-scalajs/enumeration-warnings.check @@ -1,60 +1,61 @@ --- Error: tests/neg-scalajs/enumeration-warnings.scala:6:4 ------------------------------------------------------------- -6 | Value // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:6:4 ----------------------------------------------------------- +6 | Value // warn | ^^^^^ | Could not transform call to scala.Enumeration.Value. | The resulting program is unlikely to function properly as this operation requires reflection. --- Error: tests/neg-scalajs/enumeration-warnings.scala:10:9 ------------------------------------------------------------ -10 | Value(4) // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:10:9 ---------------------------------------------------------- +10 | Value(4) // warn | ^^^^^^^^ | Could not transform call to scala.Enumeration.Value. | The resulting program is unlikely to function properly as this operation requires reflection. --- Error: tests/neg-scalajs/enumeration-warnings.scala:15:15 ----------------------------------------------------------- -15 | val a = Value(null) // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:15:15 --------------------------------------------------------- +15 | val a = Value(null) // warn | ^^^^^^^^^^^ | Passing null as name to scala.Enumeration.Value requires reflection at run-time. | The resulting program is unlikely to function properly. --- Error: tests/neg-scalajs/enumeration-warnings.scala:16:15 ----------------------------------------------------------- -16 | val b = Value(10, null) // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:16:15 --------------------------------------------------------- +16 | val b = Value(10, null) // warn | ^^^^^^^^^^^^^^^ | Passing null as name to scala.Enumeration.Value requires reflection at run-time. | The resulting program is unlikely to function properly. --- Error: tests/neg-scalajs/enumeration-warnings.scala:20:10 ----------------------------------------------------------- -20 | val a = new Val // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:20:10 --------------------------------------------------------- +20 | val a = new Val // warn | ^^^^^^^ | Calls to the non-string constructors of scala.Enumeration.Val require reflection at run-time. | The resulting program is unlikely to function properly. --- Error: tests/neg-scalajs/enumeration-warnings.scala:21:10 ----------------------------------------------------------- -21 | val b = new Val(10) // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:21:10 --------------------------------------------------------- +21 | val b = new Val(10) // warn | ^^^^^^^^^^^ | Calls to the non-string constructors of scala.Enumeration.Val require reflection at run-time. | The resulting program is unlikely to function properly. --- Error: tests/neg-scalajs/enumeration-warnings.scala:25:10 ----------------------------------------------------------- -25 | val a = new Val(null) // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:25:10 --------------------------------------------------------- +25 | val a = new Val(null) // warn | ^^^^^^^^^^^^^ | Passing null as name to a constructor of scala.Enumeration.Val requires reflection at run-time. | The resulting program is unlikely to function properly. --- Error: tests/neg-scalajs/enumeration-warnings.scala:26:10 ----------------------------------------------------------- -26 | val b = new Val(10, null) // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:26:10 --------------------------------------------------------- +26 | val b = new Val(10, null) // warn | ^^^^^^^^^^^^^^^^^ | Passing null as name to a constructor of scala.Enumeration.Val requires reflection at run-time. | The resulting program is unlikely to function properly. --- Error: tests/neg-scalajs/enumeration-warnings.scala:30:31 ----------------------------------------------------------- -30 | protected class Val1 extends Val // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:30:31 --------------------------------------------------------- +30 | protected class Val1 extends Val // warn | ^^^ | Calls to the non-string constructors of scala.Enumeration.Val require reflection at run-time. | The resulting program is unlikely to function properly. --- Error: tests/neg-scalajs/enumeration-warnings.scala:31:31 ----------------------------------------------------------- -31 | protected class Val2 extends Val(1) // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:31:31 --------------------------------------------------------- +31 | protected class Val2 extends Val(1) // warn | ^^^^^^ | Calls to the non-string constructors of scala.Enumeration.Val require reflection at run-time. | The resulting program is unlikely to function properly. --- Error: tests/neg-scalajs/enumeration-warnings.scala:35:31 ----------------------------------------------------------- -35 | protected class Val1 extends Val(null) // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:35:31 --------------------------------------------------------- +35 | protected class Val1 extends Val(null) // warn | ^^^^^^^^^ | Passing null as name to a constructor of scala.Enumeration.Val requires reflection at run-time. | The resulting program is unlikely to function properly. --- Error: tests/neg-scalajs/enumeration-warnings.scala:36:31 ----------------------------------------------------------- -36 | protected class Val2 extends Val(1, null) // error +-- Warning: tests/neg-scalajs/enumeration-warnings.scala:36:31 --------------------------------------------------------- +36 | protected class Val2 extends Val(1, null) // warn | ^^^^^^^^^^^^ | Passing null as name to a constructor of scala.Enumeration.Val requires reflection at run-time. | The resulting program is unlikely to function properly. +No warnings can be incurred under -Werror. diff --git a/tests/neg-scalajs/enumeration-warnings.scala b/tests/neg-scalajs/enumeration-warnings.scala index b48ffc9500e3..10536fef4ba6 100644 --- a/tests/neg-scalajs/enumeration-warnings.scala +++ b/tests/neg-scalajs/enumeration-warnings.scala @@ -3,35 +3,37 @@ class UnableToTransformValue extends Enumeration { val a = { println("oh, oh!") - Value // error + Value // warn } val b = { println("oh, oh!") - Value(4) // error + Value(4) // warn } } class ValueWithNullName extends Enumeration { - val a = Value(null) // error - val b = Value(10, null) // error + val a = Value(null) // warn + val b = Value(10, null) // warn } class NewValWithNoName extends Enumeration { - val a = new Val // error - val b = new Val(10) // error + val a = new Val // warn + val b = new Val(10) // warn } class NewValWithNullName extends Enumeration { - val a = new Val(null) // error - val b = new Val(10, null) // error + val a = new Val(null) // warn + val b = new Val(10, null) // warn } class ExtendsValWithNoName extends Enumeration { - protected class Val1 extends Val // error - protected class Val2 extends Val(1) // error + protected class Val1 extends Val // warn + protected class Val2 extends Val(1) // warn } class ExtendsValWithNullName extends Enumeration { - protected class Val1 extends Val(null) // error - protected class Val2 extends Val(1, null) // error + protected class Val1 extends Val(null) // warn + protected class Val2 extends Val(1, null) // warn } + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/patmat/i14407.dupe.check b/tests/patmat/i14407.dupe.check index b0605bcd95e5..e6f742314d98 100644 --- a/tests/patmat/i14407.dupe.check +++ b/tests/patmat/i14407.dupe.check @@ -1 +1,2 @@ 6: Match case Unreachable +0: No Kind diff --git a/tests/patmat/i18118.check b/tests/patmat/i18118.check index 8861eb273fb9..f7ad777f5e8c 100644 --- a/tests/patmat/i18118.check +++ b/tests/patmat/i18118.check @@ -2,3 +2,4 @@ 21: Pattern Match 32: Pattern Match 41: Pattern Match +0: No Kind