From 4aa8e40f00b78ec62a33bf91deb7157ae6714855 Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Thu, 2 Nov 2023 16:54:02 +0100 Subject: [PATCH 01/11] Report all warnings on Werror and fail at the end --- compiler/src/dotty/tools/dotc/Run.scala | 1 + .../src/dotty/tools/dotc/reporting/Reporter.scala | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/Run.scala b/compiler/src/dotty/tools/dotc/Run.scala index d85e03e92d60..795fea9d04d1 100644 --- a/compiler/src/dotty/tools/dotc/Run.scala +++ b/compiler/src/dotty/tools/dotc/Run.scala @@ -346,6 +346,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint runCtx.withProgressCallback: cb => _progress = Progress(cb, this, fusedPhases.map(_.traversals).sum) runPhases(allPhases = fusedPhases)(using runCtx) + ctx.reporter.finalizeReporting() if (!ctx.reporter.hasErrors) Rewrites.writeBack() suppressions.runFinished(hasErrors = ctx.reporter.hasErrors) diff --git a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala index 3be1a159c55c..04032fedd12a 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala @@ -172,19 +172,14 @@ abstract class Reporter extends interfaces.ReporterResult { end issueUnconfigured def issueIfNotSuppressed(dia: Diagnostic)(using Context): Unit = - def toErrorIfFatal(dia: Diagnostic) = dia match - case w: Warning if ctx.settings.silentWarnings.value => dia - case w: ConditionalWarning if w.isSummarizedConditional => dia - case w: Warning if ctx.settings.XfatalWarnings.value => w.toError - case _ => dia def go() = import Action._ dia match case w: Warning => WConf.parsed.action(dia) match case Error => issueUnconfigured(w.toError) - case Warning => issueUnconfigured(toErrorIfFatal(w)) - case Verbose => issueUnconfigured(toErrorIfFatal(w.setVerbose())) + case Warning => issueUnconfigured(w) + case Verbose => issueUnconfigured(w.setVerbose()) case Info => issueUnconfigured(w.toInfo) case Silent => case _ => issueUnconfigured(dia) @@ -214,6 +209,10 @@ abstract class Reporter extends interfaces.ReporterResult { def incomplete(dia: Diagnostic)(using Context): Unit = incompleteHandler(dia, ctx) + def finalizeReporting()(using Context) = + if (hasWarnings && ctx.settings.XfatalWarnings.value) + report(new Error("No warnings can be incurred under -Werror.", NoSourcePosition)) + /** Summary of warnings and errors */ def summary: String = { val b = new mutable.ListBuffer[String] From dd9808af7dd4ae5e91a93d6e16ddde4897261f23 Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Thu, 2 Nov 2023 19:59:23 +0100 Subject: [PATCH 02/11] Adjusted tests --- tests/neg-deep-subtype/1828.scala | 4 +- tests/neg-deep-subtype/3324b.scala | 9 ++-- tests/neg-deep-subtype/3324f.scala | 7 +-- tests/neg-deep-subtype/3324g.scala | 5 +- tests/neg-deep-subtype/JavaSeqLiteral.scala | 6 ++- .../conditionalWarnings.scala | 5 +- tests/neg-deep-subtype/gadt.scala | 6 ++- tests/neg-deep-subtype/html.scala | 4 +- tests/neg-deep-subtype/i3324.scala | 4 +- tests/neg-deep-subtype/i4297.scala | 11 ++-- tests/neg-deep-subtype/or-type-trees.scala | 9 ++-- tests/neg-deep-subtype/refined-types.scala | 9 ++-- tests/neg-deep-subtype/t2755.scala | 5 +- tests/neg-deep-subtype/type-lambda.scala | 4 +- tests/neg/14034b.scala | 17 +++--- tests/neg/15981.check | 5 +- tests/neg/15981.scala | 3 +- tests/neg/17284.check | 13 ++--- tests/neg/17284.scala | 7 +-- tests/neg/18493.check | 9 ++-- tests/neg/18493.scala | 7 +-- tests/neg/IsInstanceOfClassTag2.scala | 4 +- tests/neg/adhoc-extension/B.scala | 11 ++-- tests/neg/avoid-warn-deprecation.scala | 3 +- tests/neg/capt-wf.scala | 11 ++-- .../neg/classtag-typetest/3_1-migration.scala | 3 +- tests/neg/classtag-typetest/3_1.scala | 3 +- tests/neg/convertible.scala | 10 ++-- tests/neg/deprecated-override.scala | 6 +-- tests/neg/feature-shadowing.scala | 3 +- tests/neg/filtering-fors.scala | 21 ++++---- tests/neg/gadt-contradictory-pattern.scala | 3 +- tests/neg/i10247.scala | 9 ++-- tests/neg/i10930.scala | 9 ++-- tests/neg/i10994.scala | 4 +- tests/neg/i11022.check | 21 ++++---- tests/neg/i11022.scala | 7 +-- tests/neg/i11097.scala | 7 +-- tests/neg/i11225b.scala | 4 +- tests/neg/i11333.check | 25 ++++----- tests/neg/i11333.scala | 13 ++--- tests/neg/i11344.scala | 4 +- tests/neg/i11963a.scala | 4 +- tests/neg/i11963b.scala | 4 +- tests/neg/i11963c.scala | 4 +- tests/neg/i12188/Test.scala | 6 ++- tests/neg/i12253.check | 9 ++-- tests/neg/i12253.scala | 5 +- tests/neg/i12597.scala | 4 +- tests/neg/i13011.scala | 11 ++-- tests/neg/i13440.check | 13 ++--- tests/neg/i13440.scala | 7 +-- tests/neg/i13542.scala | 14 ++--- tests/neg/i13946/BadPrinter.scala | 3 +- tests/neg/i14386.scala | 5 +- tests/neg/i14705.scala | 4 +- tests/neg/i14721.scala | 4 +- tests/neg/i15474.scala | 7 +-- tests/neg/i15479.scala | 6 ++- tests/neg/i15503-scala2/scala2-t11681.scala | 8 +-- tests/neg/i15503a.scala | 47 +++++++++-------- tests/neg/i15503b.scala | 45 ++++++++-------- tests/neg/i15503c.scala | 17 +++--- tests/neg/i15503d.scala | 9 ++-- tests/neg/i15503e.scala | 12 ++--- tests/neg/i15503f.scala | 4 +- tests/neg/i15503g.scala | 7 +-- tests/neg/i15503h.scala | 13 ++--- tests/neg/i15503i.scala | 47 +++++++++-------- tests/neg/i15503j.scala | 7 +-- tests/neg/i15662.scala | 4 +- tests/neg/i15893.scala | 19 +++---- tests/neg/i16639a.scala | 52 +++++++++---------- tests/neg/i16649-refutable.check | 5 +- tests/neg/i16649-refutable.scala | 4 +- tests/neg/i16728.check | 5 +- tests/neg/i16728.scala | 6 ++- tests/neg/i16876/Test.scala | 5 +- tests/neg/i16930.scala | 5 +- tests/neg/i17266.check | 37 ++++++------- tests/neg/i17266.scala | 19 +++---- tests/neg/i17314b.scala | 4 +- tests/neg/i17612a.check | 33 ++++++------ tests/neg/i17612a.scala | 13 ++--- tests/neg/i17612b.check | 33 ++++++------ tests/neg/i17612b/i17612b.scala | 11 ++-- tests/neg/i17613a.check | 29 ++++++----- tests/neg/i17613a.scala | 15 +++--- tests/neg/i17613b/i17613b.scala | 33 ++++++------ tests/neg/i18722.check | 17 +++--- tests/neg/i18722.scala | 9 ++-- tests/neg/i2333.scala | 7 +-- tests/neg/i2673.scala | 4 +- tests/neg/i2673b.scala | 4 +- tests/neg/i2673c.scala | 4 +- tests/neg/i3561.scala | 5 +- tests/neg/i4008.check | 33 ++++++------ tests/neg/i4008.scala | 17 +++--- tests/neg/i4364.scala | 4 +- tests/neg/i4812.check | 29 ++++++----- tests/neg/i4812.scala | 15 +++--- tests/neg/i4936b.scala | 4 +- tests/neg/i4986b.check | 33 ++++++------ tests/neg/i4986b.scala | 11 ++-- tests/neg/i4986d.scala | 5 +- tests/neg/i5013.scala | 7 +-- tests/neg/i5013b.scala | 4 +- tests/neg/i5077.scala | 5 +- tests/neg/i6190b.check | 5 +- tests/neg/i6190b.scala | 4 +- tests/neg/i7314.scala | 4 +- tests/neg/i7821.scala | 3 +- tests/neg/i7821b.scala | 15 +++--- tests/neg/i8427.scala | 3 +- tests/neg/i8681.scala | 3 +- tests/neg/i8711.check | 17 ++++-- tests/neg/i8711.scala | 4 +- tests/neg/i8781b.scala | 4 +- tests/neg/i8922b.scala | 6 ++- tests/neg/i9166.scala | 4 +- tests/neg/i9241.scala | 17 +++--- tests/neg/i9266.check | 5 +- tests/neg/i9266.scala | 4 +- tests/neg/i9408a.check | 25 ++++----- tests/neg/i9408a.scala | 13 ++--- tests/neg/i9408b.check | 5 +- tests/neg/i9408b/Test_2.scala | 4 +- tests/neg/i9740.check | 9 ++-- tests/neg/i9740.scala | 5 +- tests/neg/i9740b.scala | 5 +- tests/neg/i9740c.scala | 4 +- tests/neg/i9740d.scala | 3 +- tests/neg/i9751.scala | 5 +- tests/neg/i9776.scala | 5 +- tests/neg/i9880.scala | 5 +- tests/neg/impl-conv/A.scala | 2 +- tests/neg/impl-conv/B.scala | 3 +- tests/neg/implicit-conversions-old.scala | 9 ++-- tests/neg/implicit-conversions.scala | 9 ++-- tests/neg/indentLeft.scala | 3 +- tests/neg/indentRight.scala | 14 ++--- tests/neg/infix.scala | 11 ++-- tests/neg/inline-givens.scala | 8 +-- tests/neg/main-functions-nameclash.scala | 4 +- tests/neg/manifest-summoning-b.check | 9 ++-- tests/neg/manifest-summoning-b.scala | 5 +- tests/neg/matchable.scala | 14 ++--- tests/neg/missing-targetName.scala | 7 +-- tests/neg/newline-braces.scala | 4 +- tests/neg/nonunit-statement.scala | 41 ++++++++------- tests/neg/old-syntax.scala | 5 +- tests/neg/opaque-match.scala | 13 ++--- tests/neg/ovlazy.scala | 4 +- tests/neg/pureStatement.scala | 11 ++-- tests/neg/quote-simple-hole.scala | 5 +- tests/neg/refinements-this.scala | 4 +- .../refutable-pattern-binding-messages.check | 25 ++++----- .../refutable-pattern-binding-messages.scala | 13 ++--- tests/neg/rewrite-messages.check | 9 ++-- tests/neg/rewrite-messages.scala | 5 +- tests/neg/strict-pattern-bindings-3.2.scala | 33 ++++++------ tests/neg/structural-2.scala | 3 +- tests/neg/supertraits-b.scala | 11 ++-- tests/neg/switches.scala | 13 ++--- tests/neg/symbolic-packages.check | 17 +++--- tests/neg/symbolic-packages.scala | 7 +-- tests/neg/t3235-minimal.check | 17 +++--- tests/neg/t3235-minimal.scala | 9 ++-- tests/neg/t5830.scala | 4 +- tests/neg/type-test-paths-2.scala | 9 ++-- tests/neg/type-test-paths.scala | 4 +- tests/neg/type-test-syntesize-b.scala | 7 +-- tests/neg/unchecked-patterns.scala | 17 +++--- tests/neg/warn-value-discard.check | 21 ++++---- tests/neg/warn-value-discard.scala | 11 ++-- .../with-type-operator-future-migration.check | 5 +- .../with-type-operator-future-migration.scala | 4 +- tests/neg/xfatalWarnings.scala | 5 +- 178 files changed, 1020 insertions(+), 805 deletions(-) diff --git a/tests/neg-deep-subtype/1828.scala b/tests/neg-deep-subtype/1828.scala index ae228a83e898..9cab8e76e832 100644 --- a/tests/neg-deep-subtype/1828.scala +++ b/tests/neg-deep-subtype/1828.scala @@ -2,10 +2,12 @@ class Test { def remove[S](a: S | Int, f: Int => S):S = a match { - case a: S => a // error + case a: S => a // warn case a: Int => f(a) } val t: Int | String = 5 val t1 = remove[String](t, _.toString) } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/3324b.scala b/tests/neg-deep-subtype/3324b.scala index df0cc5432eff..71ffde73fbdc 100644 --- a/tests/neg-deep-subtype/3324b.scala +++ b/tests/neg-deep-subtype/3324b.scala @@ -2,10 +2,11 @@ class C[T] { val x: Any = ??? - if (x.isInstanceOf[List[String]]) // error: unchecked - if (x.isInstanceOf[T]) // error: unchecked + if (x.isInstanceOf[List[String]]) // warn: unchecked + if (x.isInstanceOf[T]) // warn: unchecked x match { - case x: List[String] => // error: unchecked - case x: T => // error: unchecked + case x: List[String] => // warn: unchecked + case x: T => // warn: unchecked } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/3324f.scala b/tests/neg-deep-subtype/3324f.scala index 445da5cb25a0..e73bd0d05eed 100644 --- a/tests/neg-deep-subtype/3324f.scala +++ b/tests/neg-deep-subtype/3324f.scala @@ -5,7 +5,8 @@ class D[T] class Test { def foo[T](x: C[T]) = x match { - case _: D[T] => // error - case _: C[Int] => // error + case _: D[T] => // warn + case _: C[Int] => // warn } -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/3324g.scala b/tests/neg-deep-subtype/3324g.scala index a5b842e4e450..cd1fc660bed8 100644 --- a/tests/neg-deep-subtype/3324g.scala +++ b/tests/neg-deep-subtype/3324g.scala @@ -6,7 +6,7 @@ class Test { class C[T] extends B[Any] with A[T] def foo[T](c: C[T]): Unit = c match { - case _: B[T] => // error + case _: B[T] => // warn } def bar[T](b: B[T]): Unit = b match { @@ -14,8 +14,9 @@ class Test { } def quux[T](a: A[T]): Unit = a match { - case _: B[T] => // error!! + case _: B[T] => // warn!! } quux(new C[Int]) } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/JavaSeqLiteral.scala b/tests/neg-deep-subtype/JavaSeqLiteral.scala index 6003731ae657..863b4f436f89 100644 --- a/tests/neg-deep-subtype/JavaSeqLiteral.scala +++ b/tests/neg-deep-subtype/JavaSeqLiteral.scala @@ -10,7 +10,7 @@ object Test1 { class DummyTree extends JavaSeqLiteral[Any] def foo1(tree: Tree[Type]) = - tree.isInstanceOf[JavaSeqLiteral[Type]] // error + tree.isInstanceOf[JavaSeqLiteral[Type]] // warn foo1(new DummyTree) } @@ -28,4 +28,6 @@ object Test2 { tree.isInstanceOf[JavaSeqLiteral[Type]] foo1(new DummyTree) -} \ No newline at end of file +} + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/conditionalWarnings.scala b/tests/neg-deep-subtype/conditionalWarnings.scala index c4757cbb7546..c818b70b8ee5 100644 --- a/tests/neg-deep-subtype/conditionalWarnings.scala +++ b/tests/neg-deep-subtype/conditionalWarnings.scala @@ -5,11 +5,12 @@ object Test { given Conversion[String, Int] = _.length - foo // error + foo // warn 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 + // nopos-warn } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/gadt.scala b/tests/neg-deep-subtype/gadt.scala index 661c04fef373..ec59ca53572c 100644 --- a/tests/neg-deep-subtype/gadt.scala +++ b/tests/neg-deep-subtype/gadt.scala @@ -8,8 +8,10 @@ class Test { class D extends C def quux(a: A[C]): Unit = a match { - case _: B[C] => // error!! + case _: B[C] => // warn } quux(new B[D]) -} \ No newline at end of file +} + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/html.scala b/tests/neg-deep-subtype/html.scala index f17cfb661505..4257859e7156 100644 --- a/tests/neg-deep-subtype/html.scala +++ b/tests/neg-deep-subtype/html.scala @@ -12,9 +12,11 @@ object HTML: attrs.filter(_ != Nil).foreach{ case s: Seq[AppliedAttr] => s.foreach(sb.append(" ").append) - case s: Seq[Int] => // error + case s: Seq[Int] => // warn case e: AppliedAttr => sb.append(" ").append(e) } sb } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/i3324.scala b/tests/neg-deep-subtype/i3324.scala index 9b1060836430..154f0e5eb64d 100644 --- a/tests/neg-deep-subtype/i3324.scala +++ b/tests/neg-deep-subtype/i3324.scala @@ -2,5 +2,7 @@ class Foo { def foo(x: Any): Boolean = - x.isInstanceOf[List[String]] // error + x.isInstanceOf[List[String]] // warn } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/i4297.scala b/tests/neg-deep-subtype/i4297.scala index 9112de9de79b..3fcb427c246e 100644 --- a/tests/neg-deep-subtype/i4297.scala +++ b/tests/neg-deep-subtype/i4297.scala @@ -4,10 +4,11 @@ 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 test3a(x: Any) = x.isInstanceOf[Function1[Any, _]] // warn + def test3b(x: Any) = x.isInstanceOf[Function1[Int, _]] // warn + def test4[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[Int, _]] // warn + def test5[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[Int, Unit]] // warn + def test6[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[Int, Any]] // warn def test7[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[_, Unit]] } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/or-type-trees.scala b/tests/neg-deep-subtype/or-type-trees.scala index ad86bf20e2a3..4e74df3cea4e 100644 --- a/tests/neg-deep-subtype/or-type-trees.scala +++ b/tests/neg-deep-subtype/or-type-trees.scala @@ -9,7 +9,7 @@ object Test1 { def foo2(myTree: Tree | (Context => Tree)) = myTree match - case treeFn: (Context => Tree) => // error + case treeFn: (Context => Tree) => // warn case _ => def foo3(myTree: Tree | (Context => Tree)) = @@ -25,16 +25,17 @@ object Test2 { trait Type def foo1(myTree: Tree[Type] | (Context => Tree[Type])) = - println(myTree.isInstanceOf[Tree[Type]]) // error + println(myTree.isInstanceOf[Tree[Type]]) // warn /* 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 treeFn: (Context => Tree[Type]) => // warn case _ => def foo3(myTree: Tree[Type] | (Context => Tree[Type])) = myTree match case treeFn: (_ => _) => // ok case _ => -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/refined-types.scala b/tests/neg-deep-subtype/refined-types.scala index 5f5cc5a45f04..0e76ff58515f 100644 --- a/tests/neg-deep-subtype/refined-types.scala +++ b/tests/neg-deep-subtype/refined-types.scala @@ -18,7 +18,8 @@ def bl(x: AA) = x.isInstanceOf[BL] // was: the type test for BL cannot be checke 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 +def al_ba(x: AL) = x.isInstanceOf[BA] // warn: the type test for BA cannot be checked at runtime +def au_ba(x: AU) = x.isInstanceOf[BA] // warn: the type test for BA cannot be checked at runtime +def al_bu(x: AL) = x.isInstanceOf[BU] // warn: the type test for BU cannot be checked at runtime +def au_bl(x: AU) = x.isInstanceOf[BL] // warn: the type test for BL cannot be checked at runtime +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/t2755.scala b/tests/neg-deep-subtype/t2755.scala index a8d888f3a821..698b59a57efd 100644 --- a/tests/neg-deep-subtype/t2755.scala +++ b/tests/neg-deep-subtype/t2755.scala @@ -19,7 +19,7 @@ object Test { case x: Array[String] => x.size case x: Array[AnyRef] => 5 case x: Array[_] => 6 - case _ => 7 // error: only null is matched + case _ => 7 // warn: only null is matched } def f3[T](a: Array[T]) = a match { case x: Array[Int] => x(0) @@ -28,7 +28,7 @@ object Test { case x: Array[String] => x.size case x: Array[AnyRef] => 5 case x: Array[_] => 6 - case _ => 7 // error: only null is matched + case _ => 7 // warn: only null is matched } @@ -58,3 +58,4 @@ object Test { println(f3(null)) } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/type-lambda.scala b/tests/neg-deep-subtype/type-lambda.scala index 4c4627fe1cf3..9e1b1b408f7c 100644 --- a/tests/neg-deep-subtype/type-lambda.scala +++ b/tests/neg-deep-subtype/type-lambda.scala @@ -10,7 +10,9 @@ object Test { } def bar(x: ([X] =>> A[X])[Any]) = x match { - case x: ([X] =>> B[Nothing])[Any] => // error + case x: ([X] =>> B[Nothing])[Any] => // warn case _ => } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/14034b.scala b/tests/neg/14034b.scala index 84f9ab3579c8..7f9f4e8f1cac 100644 --- a/tests/neg/14034b.scala +++ b/tests/neg/14034b.scala @@ -3,13 +3,14 @@ @deprecated trait Exp @deprecated val exp = 1 -def test1 = exp // error -def test2(a: Exp) = () // error +def test1 = exp // warn +def test2(a: Exp) = () // warn -type Foo0 = Exp // error -type Foo = Option[Exp] // error -type Bar = Option[exp.type] // error -type Baz = Exp | Int // error +type Foo0 = Exp // warn +type Foo = Option[Exp] // warn +type Bar = Option[exp.type] // warn +type Baz = Exp | Int // warn type Quux = [X] =>> X match - case Exp => Int // error -type Quuz[A <: Exp] = Int // error + case Exp => Int // warn +type Quuz[A <: Exp] = Int // warn +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/15981.check b/tests/neg/15981.check index 10745839c566..d1cac67d2024 100644 --- a/tests/neg/15981.check +++ b/tests/neg/15981.check @@ -1,6 +1,7 @@ --- [E092] Pattern Match Error: tests/neg/15981.scala:4:45 -------------------------------------------------------------- -4 | override def equals(any: Any): Boolean = any.isInstanceOf[PosInt] // error +-- [E092] Pattern Match Unchecked Warning: tests/neg/15981.scala:4:45 -------------------------------------------------- +4 | override def equals(any: Any): Boolean = any.isInstanceOf[PosInt] // warn | ^^^ | the type test for PosInt cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` +No warnings can be incurred under -Werror. diff --git a/tests/neg/15981.scala b/tests/neg/15981.scala index 5aba3555c010..fe8c2d3bd2cc 100644 --- a/tests/neg/15981.scala +++ b/tests/neg/15981.scala @@ -1,6 +1,7 @@ //> using options -Werror val _ = locally{ sealed abstract class PosInt(val value: Int) { - override def equals(any: Any): Boolean = any.isInstanceOf[PosInt] // error + 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.check b/tests/neg/17284.check index fa248c598311..775f3e50b5f9 100644 --- a/tests/neg/17284.check +++ b/tests/neg/17284.check @@ -1,5 +1,5 @@ --- [E187] Potential Issue Error: tests/neg/17284.scala:4:6 ------------------------------------------------------------- -4 | 451.synchronized {} // error +-- [E187] Potential Issue Warning: tests/neg/17284.scala:4:6 ----------------------------------------------------------- +4 | 451.synchronized {} // warn | ^^^^^^^^^^^^^^^^ | Suspicious synchronized call on boxed class |--------------------------------------------------------------------------------------------------------------------- @@ -8,8 +8,8 @@ | You called the synchronized method on a boxed primitive. This might not be what | you intended. --------------------------------------------------------------------------------------------------------------------- --- [E187] Potential Issue Error: tests/neg/17284.scala:8:4 ------------------------------------------------------------- -8 | x.synchronized {} // error +-- [E187] Potential Issue Warning: tests/neg/17284.scala:8:4 ----------------------------------------------------------- +8 | x.synchronized {} // warn | ^^^^^^^^^^^^^^ | Suspicious synchronized call on boxed class |--------------------------------------------------------------------------------------------------------------------- @@ -18,8 +18,8 @@ | You called the synchronized method on a boxed primitive. This might not be what | you intended. --------------------------------------------------------------------------------------------------------------------- --- [E187] Potential Issue Error: tests/neg/17284.scala:11:7 ------------------------------------------------------------ -11 | true.synchronized {} // error +-- [E187] Potential Issue Warning: tests/neg/17284.scala:11:7 ---------------------------------------------------------- +11 | true.synchronized {} // warn | ^^^^^^^^^^^^^^^^^ | Suspicious synchronized call on boxed class |-------------------------------------------------------------------------------------------------------------------- @@ -28,3 +28,4 @@ | You called the synchronized method on a boxed primitive. This might not be what | you intended. -------------------------------------------------------------------------------------------------------------------- +No warnings can be incurred under -Werror. diff --git a/tests/neg/17284.scala b/tests/neg/17284.scala index 8f588233245a..5b99fd140193 100644 --- a/tests/neg/17284.scala +++ b/tests/neg/17284.scala @@ -1,14 +1,15 @@ //> using options -Werror -explain def test = - 451.synchronized {} // error + 451.synchronized {} // warn def test2 = val x: Integer = 451 - x.synchronized {} // error + x.synchronized {} // warn def test3 = - true.synchronized {} // error + true.synchronized {} // warn def test4 = true.hashCode() // success +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/18493.check b/tests/neg/18493.check index 79a2872e71e8..2e78702c12e9 100644 --- a/tests/neg/18493.check +++ b/tests/neg/18493.check @@ -1,8 +1,9 @@ --- [E030] Match case Unreachable Error: tests/neg/18493.scala:6:9 ------------------------------------------------------ -6 | case "abc" => // error +-- [E030] Match case Unreachable Warning: tests/neg/18493.scala:6:9 ---------------------------------------------------- +6 | case "abc" => // warn | ^^^^^ | Unreachable case --- [E030] Match case Unreachable Error: tests/neg/18493.scala:12:9 ----------------------------------------------------- -12 | case "abc" => // error +-- [E030] Match case Unreachable Warning: tests/neg/18493.scala:12:9 --------------------------------------------------- +12 | case "abc" => // warn | ^^^^^ | Unreachable case +No warnings can be incurred under -Werror. diff --git a/tests/neg/18493.scala b/tests/neg/18493.scala index 8dfb3bf923cc..006c275aa7fc 100644 --- a/tests/neg/18493.scala +++ b/tests/neg/18493.scala @@ -3,12 +3,13 @@ object PartialFunctionNoWarning { // nice warning "abc" match { case "abc" => - case "abc" => // error + case "abc" => // warn } // no warnings val pf: PartialFunction[String, Unit] = { case "abc" => - case "abc" => // error + case "abc" => // warn } -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/IsInstanceOfClassTag2.scala b/tests/neg/IsInstanceOfClassTag2.scala index 9246c7fca84d..a2a7194d4e39 100644 --- a/tests/neg/IsInstanceOfClassTag2.scala +++ b/tests/neg/IsInstanceOfClassTag2.scala @@ -11,7 +11,7 @@ object IsInstanceOfClassTag { } def main(args: Array[String]): Unit = { - safeCast[List[String]](List[Int](1)) match { // error + safeCast[List[String]](List[Int](1)) match { // warn case None => case Some(xs) => } @@ -22,3 +22,5 @@ object IsInstanceOfClassTag { } } } + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/adhoc-extension/B.scala b/tests/neg/adhoc-extension/B.scala index 2343a9bc0060..efa783f87178 100644 --- a/tests/neg/adhoc-extension/B.scala +++ b/tests/neg/adhoc-extension/B.scala @@ -1,10 +1,11 @@ //> using options -source future -feature -Xfatal-warnings package adhoc -class B extends A // error: adhoc-extension (under -strict -feature -Xfatal-warnings) -class C extends A // error +class B extends A // warn: adhoc-extension (under -strict -feature -Xfatal-warnings) +class C extends A // warn object O { - val a = new A {} // error - object E extends A // error -} \ No newline at end of file + val a = new A {} // warn + object E extends A // warn +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/avoid-warn-deprecation.scala b/tests/neg/avoid-warn-deprecation.scala index 45baf7addb86..f14ebd30a98f 100644 --- a/tests/neg/avoid-warn-deprecation.scala +++ b/tests/neg/avoid-warn-deprecation.scala @@ -8,4 +8,5 @@ object A { object B { A.foo } -// nopos-error there was 1 deprecation warning; re-run with -deprecation for details +// nopos-warn there was 1 deprecation warning; re-run with -deprecation for details +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/capt-wf.scala b/tests/neg/capt-wf.scala index 0e1e4be2ca67..fe18a6f5f16b 100644 --- a/tests/neg/capt-wf.scala +++ b/tests/neg/capt-wf.scala @@ -13,12 +13,12 @@ def test(c: Cap, other: String): Unit = val x3a: () -> String = s1 val s2 = () => if x1 == null then "" else "abc" val x4: C^{s2} = ??? // OK - val x5: C^{c, c} = ??? // error: redundant // error: redundant + val x5: C^{c, c} = ??? // warn: redundant // warn: redundant // val x6: C^{c}^{c} = ??? // would be syntax error - val x7: Cap^{c} = ??? // error: redundant + val x7: Cap^{c} = ??? // warn: redundant // val x8: C^{c}^{cap} = ??? // would be syntax error - val x9: C^{c, cap} = ??? // error: redundant - val x10: C^{cap, c} = ??? // error: redundant + val x9: C^{c, cap} = ??? // warn: redundant + val x10: C^{cap, c} = ??? // warn: redundant def even(n: Int): Boolean = if n == 0 then true else odd(n - 1) def odd(n: Int): Boolean = if n == 1 then true else even(n - 1) @@ -34,4 +34,5 @@ def test(c: Cap, other: String): Unit = if n == 0 then true else od(n - 1) val y3: String^{ev} = ??? // error cs is empty - () \ No newline at end of file + () +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/classtag-typetest/3_1-migration.scala b/tests/neg/classtag-typetest/3_1-migration.scala index 41e0537a6dc1..fb8f3beedc48 100644 --- a/tests/neg/classtag-typetest/3_1-migration.scala +++ b/tests/neg/classtag-typetest/3_1-migration.scala @@ -5,4 +5,5 @@ import scala.reflect.ClassTag def f3_1m[T: ClassTag](x: Any): Unit = x match - case _: T => // error + case _: T => // warn +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/classtag-typetest/3_1.scala b/tests/neg/classtag-typetest/3_1.scala index d9101ff2ae57..798489bb90fa 100644 --- a/tests/neg/classtag-typetest/3_1.scala +++ b/tests/neg/classtag-typetest/3_1.scala @@ -5,4 +5,5 @@ import scala.reflect.ClassTag def f3_1[T: ClassTag](x: Any): Unit = x match - case _: T => // error + case _: T => // warn +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/convertible.scala b/tests/neg/convertible.scala index e72de452f41d..9ddc75a982a7 100644 --- a/tests/neg/convertible.scala +++ b/tests/neg/convertible.scala @@ -11,9 +11,9 @@ object Test: def f(x: Text, y: => Text, zs: Text*) = println(s"${x.str} ${y.str} ${zs.map(_.str).mkString(" ")}") - f("abc", "def") // error // error - f("abc", "def", "xyz", "uvw") // error // error // error // error - f("abc", "def", "xyz", Text("uvw")) // error // error // error + f("abc", "def") // warn // warn + f("abc", "def", "xyz", "uvw") // warn // warn // warn // warn + f("abc", "def", "xyz", Text("uvw")) // warn // warn // warn def g(x: into Text) = println(x.str) @@ -27,5 +27,5 @@ object Test: def h(x: into Text) = val y = h1(x) - y("abc") // error, inference through type variable does not propagate - + y("abc") // warn, inference through type variable does not propagate +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/deprecated-override.scala b/tests/neg/deprecated-override.scala index b532416c7126..c167dd720666 100644 --- a/tests/neg/deprecated-override.scala +++ b/tests/neg/deprecated-override.scala @@ -7,10 +7,10 @@ class B extends A: @deprecatedOverriding def f = 1 class C extends B: - override def f = 2 // error + override def f = 2 // warn trait D extends A: override def f = 3 -object E extends B, D // error - +object E extends B, D // warn +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/feature-shadowing.scala b/tests/neg/feature-shadowing.scala index 16286d5eea87..891d8735aa41 100644 --- a/tests/neg/feature-shadowing.scala +++ b/tests/neg/feature-shadowing.scala @@ -8,8 +8,9 @@ object a: object b: import language.implicitConversions as _ - val s: String = 2 // error + val s: String = 2 // warn object c: import language.implicitConversions val s: String = 3 // OK again +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/filtering-fors.scala b/tests/neg/filtering-fors.scala index 7d998a37f057..ef6d7790ce7e 100644 --- a/tests/neg/filtering-fors.scala +++ b/tests/neg/filtering-fors.scala @@ -8,18 +8,18 @@ object Test { for (x: Any <- xs) do () // OK for (x: String <- xs) do () // error - for ((x: String) <- xs) do () // error - for (y@ (x: String) <- xs) do () // error - for ((x, y) <- xs) do () // error + for ((x: String) <- xs) do () // warn + for (y@ (x: String) <- xs) do () // warn + for ((x, y) <- xs) do () // warn - for ((x: String) <- xs if x.isEmpty) do () // error - for ((x: String) <- xs; y = x) do () // error - for ((x: String) <- xs; (y, z) <- xs) do () // error // error - for (case (x: String) <- xs; (y, z) <- xs) do () // error - for ((x: String) <- xs; case (y, z) <- xs) do () // error + for ((x: String) <- xs if x.isEmpty) do () // warn + for ((x: String) <- xs; y = x) do () // warn + for ((x: String) <- xs; (y, z) <- xs) do () // warn // warn + for (case (x: String) <- xs; (y, z) <- xs) do () // warn + for ((x: String) <- xs; case (y, z) <- xs) do () // warn val pairs: List[AnyRef] = List((1, 2), "hello", (3, 4)) - for ((x, y) <- pairs) yield (y, x) // error + for ((x, y) <- pairs) yield (y, x) // warn for (case x: String <- xs) do () // OK for (case (x: String) <- xs) do () // OK @@ -31,4 +31,5 @@ object Test { for (case (x: String) <- xs; case (y, z) <- xs) do () // OK for (case (x, y) <- pairs) yield (y, x) // OK -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/gadt-contradictory-pattern.scala b/tests/neg/gadt-contradictory-pattern.scala index 6fbd06120a48..ed8b343c9545 100644 --- a/tests/neg/gadt-contradictory-pattern.scala +++ b/tests/neg/gadt-contradictory-pattern.scala @@ -6,9 +6,10 @@ object Test { case object Bar3 extends Foo[AnyRef] def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match { - case (Bar1, Bar1) => () // error // error + case (Bar1, Bar1) => () // warn // warn case (Bar2, Bar3) => () case (Bar3, _) => () } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i10247.scala b/tests/neg/i10247.scala index fc6268720a6d..e98b2dc6e9c2 100644 --- a/tests/neg/i10247.scala +++ b/tests/neg/i10247.scala @@ -1,6 +1,6 @@ //> using options -Xfatal-warnings -deprecation -def usered = Color.Red // error: value Red is deprecated +def usered = Color.Red // warn: value Red is deprecated object DeprecatedContainer { @deprecated("no foo", "0.1") val foo = 23 @@ -18,11 +18,12 @@ enum Color { @deprecated("no Generic", "0.1") case Generic(rgb: Int) - def useFoo1 = DeprecatedContainer.foo // error // check that only enum cases are avoided - def useMonday = Day.Monday // error // check that enum cases are declared in this enum + def useFoo1 = DeprecatedContainer.foo // warn // check that only enum cases are avoided + def useMonday = Day.Monday // warn // check that enum cases are declared in this enum } object Color { - def useFoo2 = DeprecatedContainer.foo // error // check that only enum cases are avoided + def useFoo2 = DeprecatedContainer.foo // warn // check that only enum cases are avoided } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i10930.scala b/tests/neg/i10930.scala index 5f8a0ca1ba76..fe9009a52292 100644 --- a/tests/neg/i10930.scala +++ b/tests/neg/i10930.scala @@ -9,7 +9,8 @@ import language.future case AnyVal => X def leafElem[X](x: X): LeafElem[X] = x match - case x: String => x.charAt(0) // error - case x: Array[t] => leafElem(x(1)) // error - case x: Iterable[t] => leafElem(x.head) // error - case x: AnyVal => x // error + case x: String => x.charAt(0) // warn + case x: Array[t] => leafElem(x(1)) // warn + case x: Iterable[t] => leafElem(x.head) // warn + case x: AnyVal => x // warn +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i10994.scala b/tests/neg/i10994.scala index f5f237f22dd6..ce553c77c5ae 100644 --- a/tests/neg/i10994.scala +++ b/tests/neg/i10994.scala @@ -1,4 +1,6 @@ //> using options -Xfatal-warnings def foo = true match - case (b: Boolean): Boolean => () // error + case (b: Boolean): Boolean => () // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i11022.check b/tests/neg/i11022.check index 55bdb0526264..65e3083d95e4 100644 --- a/tests/neg/i11022.check +++ b/tests/neg/i11022.check @@ -1,20 +1,21 @@ --- Error: tests/neg/i11022.scala:10:7 ---------------------------------------------------------------------------------- -10 |val a: CaseClass = CaseClass(42) // error: deprecated type // error: deprecated apply method +-- Deprecation Warning: tests/neg/i11022.scala:10:7 -------------------------------------------------------------------- +10 |val a: CaseClass = CaseClass(42) // warn: deprecated type // warn: deprecated apply method | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass --- Error: tests/neg/i11022.scala:10:19 --------------------------------------------------------------------------------- -10 |val a: CaseClass = CaseClass(42) // error: deprecated type // error: deprecated apply method +-- Deprecation Warning: tests/neg/i11022.scala:10:19 ------------------------------------------------------------------- +10 |val a: CaseClass = CaseClass(42) // warn: deprecated type // warn: deprecated apply method | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass --- Error: tests/neg/i11022.scala:11:7 ---------------------------------------------------------------------------------- -11 |val b: CaseClass = new CaseClass(42) // error: deprecated type // error: deprecated class +-- Deprecation Warning: tests/neg/i11022.scala:11:7 -------------------------------------------------------------------- +11 |val b: CaseClass = new CaseClass(42) // warn: deprecated type // warn: deprecated class | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass --- Error: tests/neg/i11022.scala:11:23 --------------------------------------------------------------------------------- -11 |val b: CaseClass = new CaseClass(42) // error: deprecated type // error: deprecated class +-- Deprecation Warning: tests/neg/i11022.scala:11:23 ------------------------------------------------------------------- +11 |val b: CaseClass = new CaseClass(42) // warn: deprecated type // warn: deprecated class | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass --- Error: tests/neg/i11022.scala:12:14 --------------------------------------------------------------------------------- -12 |val c: Unit = CaseClass(42).magic() // error: deprecated apply method +-- Deprecation Warning: tests/neg/i11022.scala:12:14 ------------------------------------------------------------------- +12 |val c: Unit = CaseClass(42).magic() // warn: deprecated apply method | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass +No warnings can be incurred under -Werror. diff --git a/tests/neg/i11022.scala b/tests/neg/i11022.scala index 14bc600666f9..475f65695251 100644 --- a/tests/neg/i11022.scala +++ b/tests/neg/i11022.scala @@ -7,7 +7,8 @@ case class CaseClass(rgb: Int): object CaseClass: def notDeprecated(): Unit = () -val a: CaseClass = CaseClass(42) // error: deprecated type // error: deprecated apply method -val b: CaseClass = new CaseClass(42) // error: deprecated type // error: deprecated class -val c: Unit = CaseClass(42).magic() // error: deprecated apply method +val a: CaseClass = CaseClass(42) // warn: deprecated type // warn: deprecated apply method +val b: CaseClass = new CaseClass(42) // warn: deprecated type // warn: deprecated class +val c: Unit = CaseClass(42).magic() // warn: deprecated apply method val d: Unit = CaseClass.notDeprecated() // compiles +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i11097.scala b/tests/neg/i11097.scala index 149fe89249c8..b1f0b0bfd300 100644 --- a/tests/neg/i11097.scala +++ b/tests/neg/i11097.scala @@ -4,12 +4,13 @@ class C { type T1; type T2 } def pmatch(s: C): s.T2 = s match { - case p: (C { type T1 = Int; type T2 >: T1 } & s.type) => // error + case p: (C { type T1 = Int; type T2 >: T1 } & s.type) => // warn (3: p.T1): p.T2 - case p: (C { type T1 = String; type T2 >: T1 } & s.type) => // error + case p: (C { type T1 = String; type T2 >: T1 } & s.type) => // warn ("this branch should be matched": p.T1): p.T2 } // ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String val x = pmatch(new C { type T1 = String; type T2 = String }) -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i11225b.scala b/tests/neg/i11225b.scala index a9dd1d3d2227..b66cd3865f49 100644 --- a/tests/neg/i11225b.scala +++ b/tests/neg/i11225b.scala @@ -3,10 +3,12 @@ import compiletime.uninitialized class Memo[A](x: => A): - private var cached: A = _ // error + private var cached: A = _ // warn private var known: Boolean = false def force = if !known then known = true cached = x cached + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i11333.check b/tests/neg/i11333.check index ba5723488899..05f6de27062c 100644 --- a/tests/neg/i11333.check +++ b/tests/neg/i11333.check @@ -1,30 +1,31 @@ --- [E167] Lossy Conversion Error: tests/neg/i11333.scala:4:19 ---------------------------------------------------------- -4 | val f1: Float = 123456789 // error +-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:4:19 -------------------------------------------------------- +4 | val f1: Float = 123456789 // warn | ^^^^^^^^^ | Widening conversion from Int to Float loses precision. | Write `.toFloat` instead. --- [E167] Lossy Conversion Error: tests/neg/i11333.scala:5:19 ---------------------------------------------------------- -5 | val d1: Double = 1234567890123456789L // error +-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:5:19 -------------------------------------------------------- +5 | val d1: Double = 1234567890123456789L // warn | ^^^^^^^^^^^^^^^^^^^^ | Widening conversion from Long to Double loses precision. | Write `.toDouble` instead. --- [E167] Lossy Conversion Error: tests/neg/i11333.scala:6:19 ---------------------------------------------------------- -6 | val f2: Float = 123456789L // error +-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:6:19 -------------------------------------------------------- +6 | val f2: Float = 123456789L // warn | ^^^^^^^^^^ | Widening conversion from Long to Float loses precision. | Write `.toFloat` instead. --- [E167] Lossy Conversion Error: tests/neg/i11333.scala:12:21 --------------------------------------------------------- -12 | val f1_b: Float = i1 // error +-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:12:21 ------------------------------------------------------- +12 | val f1_b: Float = i1 // warn | ^^ | Widening conversion from Int to Float loses precision. | Write `.toFloat` instead. --- [E167] Lossy Conversion Error: tests/neg/i11333.scala:13:21 --------------------------------------------------------- -13 | val d1_b: Double = l1 // error +-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:13:21 ------------------------------------------------------- +13 | val d1_b: Double = l1 // warn | ^^ | Widening conversion from Long to Double loses precision. | Write `.toDouble` instead. --- [E167] Lossy Conversion Error: tests/neg/i11333.scala:14:21 --------------------------------------------------------- -14 | val f2_b: Float = l2 // error +-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:14:21 ------------------------------------------------------- +14 | val f2_b: Float = l2 // warn | ^^ | Widening conversion from Long to Float loses precision. | Write `.toFloat` instead. +No warnings can be incurred under -Werror. diff --git a/tests/neg/i11333.scala b/tests/neg/i11333.scala index bbdcceaf7e1e..5149a99e7063 100644 --- a/tests/neg/i11333.scala +++ b/tests/neg/i11333.scala @@ -1,14 +1,15 @@ //> using options -Xfatal-warnings class C: - val f1: Float = 123456789 // error - val d1: Double = 1234567890123456789L // error - val f2: Float = 123456789L // error + val f1: Float = 123456789 // warn + val d1: Double = 1234567890123456789L // warn + val f2: Float = 123456789L // warn inline val i1 = 123456789 inline val l1 = 1234567890123456789L inline val l2 = 123456789L - val f1_b: Float = i1 // error - val d1_b: Double = l1 // error - val f2_b: Float = l2 // error + val f1_b: Float = i1 // warn + val d1_b: Double = l1 // warn + val f2_b: Float = l2 // warn +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i11344.scala b/tests/neg/i11344.scala index 0602fe14a995..04c1b6f7f2d3 100644 --- a/tests/neg/i11344.scala +++ b/tests/neg/i11344.scala @@ -3,6 +3,8 @@ trait Pet(val name: String, rest: Int): def f(suffix: String) = s"$name$suffix$rest" -class Birdie(override val name: String) extends Pet("huh", 1) // error +class Birdie(override val name: String) extends Pet("huh", 1) // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i11963a.scala b/tests/neg/i11963a.scala index 0eb2f557624f..5212a51826c4 100644 --- a/tests/neg/i11963a.scala +++ b/tests/neg/i11963a.scala @@ -1,3 +1,5 @@ //> using options -Xfatal-warnings -open trait Foo // error +open trait Foo // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i11963b.scala b/tests/neg/i11963b.scala index 76097b225896..e549488b79b7 100644 --- a/tests/neg/i11963b.scala +++ b/tests/neg/i11963b.scala @@ -1,3 +1,5 @@ //> using options -Xfatal-warnings -open abstract class Foo // error +open abstract class Foo // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i11963c.scala b/tests/neg/i11963c.scala index f58f68c72368..8e91632f0bc2 100644 --- a/tests/neg/i11963c.scala +++ b/tests/neg/i11963c.scala @@ -2,7 +2,9 @@ object Test { def foo: Any = { - open class Bar // error + open class Bar // warn new Bar } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i12188/Test.scala b/tests/neg/i12188/Test.scala index 66864438694e..9bbbf6431b13 100644 --- a/tests/neg/i12188/Test.scala +++ b/tests/neg/i12188/Test.scala @@ -7,5 +7,7 @@ case class PC2(b: Int) extends P def Test = MatchTest.test(PC2(10): P) def foo(x: P): Unit = - x match // error - case _: PC1 => \ No newline at end of file + x match // warn + case _: PC1 => + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i12253.check b/tests/neg/i12253.check index 75a698249dee..e0a5886ad676 100644 --- a/tests/neg/i12253.check +++ b/tests/neg/i12253.check @@ -1,13 +1,14 @@ --- [E092] Pattern Match Error: tests/neg/i12253.scala:13:10 ------------------------------------------------------------ -13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // error // error +-- [E092] Pattern Match Unchecked Warning: tests/neg/i12253.scala:13:10 ------------------------------------------------ +13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // warn // warn | ^ |the type test for extractors.q2.reflect.Term cannot be checked at runtime because it refers to an abstract type member or type parameter | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Error: tests/neg/i12253.scala:13:38 ------------------------------------------------------------ -13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // error // error +-- [E092] Pattern Match Unchecked Warning: tests/neg/i12253.scala:13:38 ------------------------------------------------ +13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // warn // warn | ^ |the type test for q1.reflect.Select cannot be checked at runtime because it refers to an abstract type member or type parameter | | longer explanation available when compiling with `-explain` +No warnings can be incurred under -Werror. there was 1 deprecation warning; re-run with -deprecation for details diff --git a/tests/neg/i12253.scala b/tests/neg/i12253.scala index 540ff8ef6d5b..51677c10b5f0 100644 --- a/tests/neg/i12253.scala +++ b/tests/neg/i12253.scala @@ -10,7 +10,7 @@ object MacroUtils: import quotes.reflect.* val extractors = new Extractors code.asTerm match - case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // error // error + case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // warn // warn case t => report.throwError(s"Illegal argument to extractor: ${code.show}, in tasty: $t") class Extractors(using val q2: Quotes): @@ -27,4 +27,5 @@ object MacroUtils: end Extractors end MacroUtils -// nopos-error + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i12597.scala b/tests/neg/i12597.scala index b8859a0ae991..241e1b09e2a9 100644 --- a/tests/neg/i12597.scala +++ b/tests/neg/i12597.scala @@ -3,5 +3,7 @@ @main def Test = val a: IArray[Int] = IArray(2) val b: IArray[Any] = a - val c = b.toArray // error: deprecated + val c = b.toArray // warn: deprecated c(0) = "" + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i13011.scala b/tests/neg/i13011.scala index c0541aeb7f8e..fca3fcf7dded 100644 --- a/tests/neg/i13011.scala +++ b/tests/neg/i13011.scala @@ -1,23 +1,24 @@ //> using options -Xfatal-warnings class i13011 { - lazy implicit val simple1: String = simple1 // error + lazy implicit val simple1: String = simple1 // warn def f: Unit = { - lazy val simple2: String = simple2 // error + lazy val simple2: String = simple2 // warn } - lazy val simple3: String = if true then this.simple3 else "a" // error + lazy val simple3: String = if true then this.simple3 else "a" // warn def firstDigitIsEven(n: Int): Boolean = if n % 10 == n then n % 2 == 0 else firstDigitIsEven(n / 10) lazy val simple4: String = if firstDigitIsEven(22) then this.simple4 else "a" // ok - lazy val simple5: String = identity(this.simple5) // error + lazy val simple5: String = identity(this.simple5) // warn - lazy val simple6: String = { // error + lazy val simple6: String = { // warn this.simple6 "aa" } lazy val simple7: Function0[Any] = () => this.simple7 // Ok } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i13440.check b/tests/neg/i13440.check index c820ee67833d..b173835cc3bb 100644 --- a/tests/neg/i13440.check +++ b/tests/neg/i13440.check @@ -1,12 +1,13 @@ --- Error: tests/neg/i13440.scala:5:4 ----------------------------------------------------------------------------------- -5 |def given = 42 // error +-- Migration Warning: tests/neg/i13440.scala:5:4 ----------------------------------------------------------------------- +5 |def given = 42 // warn | ^ | given is now a keyword, write `given` instead of given to keep it as an identifier --- Error: tests/neg/i13440.scala:7:13 ---------------------------------------------------------------------------------- -7 |case class C(enum: List[Int] = Nil) { // error +-- Migration Warning: tests/neg/i13440.scala:7:13 ---------------------------------------------------------------------- +7 |case class C(enum: List[Int] = Nil) { // warn | ^ | enum is now a keyword, write `enum` instead of enum to keep it as an identifier --- Error: tests/neg/i13440.scala:8:11 ---------------------------------------------------------------------------------- -8 | val s = s"$enum" // error +-- Migration Warning: tests/neg/i13440.scala:8:11 ---------------------------------------------------------------------- +8 | val s = s"$enum" // warn | ^ | enum is now a keyword, write `enum` instead of enum to keep it as an identifier +No warnings can be incurred under -Werror. diff --git a/tests/neg/i13440.scala b/tests/neg/i13440.scala index 443215c621ef..6b8bf99e08d3 100644 --- a/tests/neg/i13440.scala +++ b/tests/neg/i13440.scala @@ -2,8 +2,9 @@ import language.`3.0-migration` -def given = 42 // error +def given = 42 // warn -case class C(enum: List[Int] = Nil) { // error - val s = s"$enum" // error +case class C(enum: List[Int] = Nil) { // warn + val s = s"$enum" // warn } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i13542.scala b/tests/neg/i13542.scala index c0feb88b556d..404ddc0af2e5 100644 --- a/tests/neg/i13542.scala +++ b/tests/neg/i13542.scala @@ -16,12 +16,12 @@ def lazyIdentity[T](x: => T): T = x def repIdentity[T](x: T*): T = x(0) val x1 = - implicit def barToFoo(bar: Bar): Foo = bar.toFoo // error: infinite loop in function body + implicit def barToFoo(bar: Bar): Foo = bar.toFoo // warn: infinite loop in function body val foo: Foo = Bar(1) val x2 = implicit def barToFoo2(bar: Bar): Foo = - identity(bar.toFoo) // error + identity(bar.toFoo) // warn val foo: Foo = Bar(1) val x3 = @@ -31,12 +31,12 @@ val x3 = val x4 = implicit def barToFoo4(bar: Bar): Foo = - repIdentity(bar.toFoo) // error + repIdentity(bar.toFoo) // warn val foo: Foo = Bar(1) val x5 = implicit def barToFoo4(bar: Bar): Foo = - val y = bar.toFoo // error + val y = bar.toFoo // warn y val foo: Foo = Bar(1) @@ -45,8 +45,4 @@ val x6 = lazy val y = bar.toFoo if false then y else ??? val foo: Foo = Bar(1) - - - - - +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i13946/BadPrinter.scala b/tests/neg/i13946/BadPrinter.scala index 46913d2c2805..39e8a921d498 100644 --- a/tests/neg/i13946/BadPrinter.scala +++ b/tests/neg/i13946/BadPrinter.scala @@ -2,5 +2,6 @@ // in BadPrinter.scala import language.future -class BadPrinter extends Printer: // error +class BadPrinter extends Printer: // warn override def print(s: String): Unit = println("Bad!!!") +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i14386.scala b/tests/neg/i14386.scala index be0b2497ed5f..d9647da49525 100644 --- a/tests/neg/i14386.scala +++ b/tests/neg/i14386.scala @@ -42,7 +42,8 @@ def braced() = s"""begin ${ val level = 10 - val msg = "hello, world" // error he lets me off with a warning - log(level, msg) // error + val msg = "hello, world" // warn he lets me off with a warning + log(level, msg) // warn } end""" +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i14705.scala b/tests/neg/i14705.scala index 9ffb4443416e..36646130a8a8 100644 --- a/tests/neg/i14705.scala +++ b/tests/neg/i14705.scala @@ -1,5 +1,7 @@ //> using options -Xfatal-warnings val n = Nil -val b = n.head.isInstanceOf[String] // error +val b = n.head.isInstanceOf[String] // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i14721.scala b/tests/neg/i14721.scala index 46786f04558b..46b9c4bb5b2a 100644 --- a/tests/neg/i14721.scala +++ b/tests/neg/i14721.scala @@ -6,4 +6,6 @@ class C: def test: Unit = try op catch case _: NullPointerException => - handler // error + handler // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i15474.scala b/tests/neg/i15474.scala index 8edf97a1e55a..ff4fd7b641ef 100644 --- a/tests/neg/i15474.scala +++ b/tests/neg/i15474.scala @@ -4,7 +4,7 @@ import scala.language.implicitConversions object Test1: given c: Conversion[ String, Int ] with - def apply(from: String): Int = from.toInt // error + def apply(from: String): Int = from.toInt // warn object Test2: given c: Conversion[ String, Int ] = _.toInt // loop not detected, could be used as a fallback to avoid the warning. @@ -13,6 +13,7 @@ object Prices { opaque type Price = BigDecimal object Price{ - given Ordering[Price] = summon[Ordering[BigDecimal]] // error + given Ordering[Price] = summon[Ordering[BigDecimal]] // warn } -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15479.scala b/tests/neg/i15479.scala index d4f306a12368..0da30ab749e2 100644 --- a/tests/neg/i15479.scala +++ b/tests/neg/i15479.scala @@ -8,11 +8,13 @@ package deptest { } package depuser { - import deptest.DeprecatedThing.* // error + import deptest.DeprecatedThing.* // warn object DepUser { def main(args: Array[String]): Unit = println { oldValue } } -} \ No newline at end of file +} + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503-scala2/scala2-t11681.scala b/tests/neg/i15503-scala2/scala2-t11681.scala index 2436668e0c9c..af11eb4512d6 100644 --- a/tests/neg/i15503-scala2/scala2-t11681.scala +++ b/tests/neg/i15503-scala2/scala2-t11681.scala @@ -10,7 +10,7 @@ trait InterFace { trait BadAPI extends InterFace { private def f(a: Int, - b: String, // error + b: String, // warn c: Double): Int = { println(c) a @@ -50,7 +50,7 @@ trait PoorClient extends BadAPI { override def f(a: Int, b: String, c: Double): Int = a + b.toInt + c.toInt } -class Unusing(u: Int) { // error +class Unusing(u: Int) { // warn def f = ??? } @@ -107,4 +107,6 @@ object Answers { def answer: Int = 42 } -val a$1 = 2 \ No newline at end of file +val a$1 = 2 + +// nopo-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503a.scala b/tests/neg/i15503a.scala index b5f17a1e2f52..b4655a37db33 100644 --- a/tests/neg/i15503a.scala +++ b/tests/neg/i15503a.scala @@ -2,12 +2,12 @@ object FooUnused: - import collection.mutable.Set // error - import collection.mutable.{Map => MutMap} // error - import collection.mutable._ // error + import collection.mutable.Set // warn + import collection.mutable.{Map => MutMap} // warn + import collection.mutable._ // warn object FooWildcardUnused: - import collection.mutable._ // error + import collection.mutable._ // warn object Foo: import collection.mutable.Set // OK @@ -22,7 +22,7 @@ object FooWildcard: val bar = Set() // OK object FooNestedUnused: - import collection.mutable.Set // error + import collection.mutable.Set // warn object Nested: def hello = 1 @@ -32,11 +32,11 @@ object FooNested: def hello = Set() object FooGivenUnused: - import SomeGivenImports.given // error + import SomeGivenImports.given // warn object FooGiven: import SomeGivenImports.given // OK - import SomeGivenImports._ // error + import SomeGivenImports._ // warn val foo = summon[Int] @@ -52,7 +52,7 @@ object FooTypeName: import collection.mutable.Map // OK import collection.mutable.Seq // OK import collection.mutable.ArrayBuilder // OK - import collection.mutable.ListBuffer // error + import collection.mutable.ListBuffer // warn def checkImplicit[A](using Set[A]) = () def checkParamType[B](a: Map[B,B]): Seq[B] = ??? @@ -64,12 +64,12 @@ object FooTypeName: object InlineChecks: object InlineFoo: import collection.mutable.Set // ok - import collection.mutable.Map // error + import collection.mutable.Map // warn inline def getSet = Set(1) object InlinedBar: import collection.mutable.Set // ok - import collection.mutable.Map // error + import collection.mutable.Map // warn val a = InlineFoo.getSet object MacroChecks: @@ -80,7 +80,7 @@ object MacroChecks: object InnerMostCheck: - import collection.mutable.* // error + import collection.mutable.* // warn def check = import collection.mutable.* //OK val a = Set(1) @@ -88,7 +88,7 @@ object InnerMostCheck: object IgnoreExclusion: import collection.mutable.{Set => _} // OK import collection.mutable.{Map => _} // OK - import collection.mutable.{ListBuffer} // error + import collection.mutable.{ListBuffer} // warn def check = val a = Set(1) val b = Map(1 -> 2) @@ -106,7 +106,7 @@ package testsamepackageimport: } package p { - import p._ // error + import p._ // warn package q { class U { def f = new C @@ -120,7 +120,7 @@ package testpackageimport: val x: Int = 0 package b: - import a._ // error + import a._ // warn /* END : Check on packages*/ @@ -149,7 +149,7 @@ object GivenImportOrderAtoB: object A { implicit val x: X = new X } object B { implicit val y: Y = new Y } class C { - import A._ // error + import A._ // warn import B._ // OK def t = implicitly[X] } @@ -161,7 +161,7 @@ object GivenImportOrderBtoA: object B { implicit val y: Y = new Y } class C { import B._ // OK - import A._ // error + import A._ // warn def t = implicitly[X] } /* END : tests on given import order */ @@ -174,19 +174,19 @@ object Scala2ImplicitsGiven: import A.given // OK val b = summon[Int] object C: - import A.given // error + import A.given // warn val b = 1 object D: import A._ // OK val b = summon[Int] object E: - import A._ // error + import A._ // warn val b = 1 object F: import A.x // OK val b = summon[Int] object G: - import A.x // error + import A.x // warn val b = 1 // ------------------------------------- @@ -226,7 +226,7 @@ package testOnOverloadedMethodsImports: package b: object D extends a.C package c: - import b.D.foo // error + import b.D.foo // warn package d: import b.D.foo // OK def bar = foo((??? : a.A)) @@ -242,13 +242,13 @@ package testOnOverloadedMethodsImports: package foo.testing.rename.imports: import collection.mutable.{Set => MutSet1} // OK import collection.mutable.{Set => MutSet2} // OK - import collection.mutable.{Set => MutSet3} // error + import collection.mutable.{Set => MutSet3} // warn type A[X] = MutSet1[X] val a = MutSet2(1) //------------------------------------- package foo.testing.imports.precedence: - import scala.collection.immutable.{BitSet => _, _} // error + import scala.collection.immutable.{BitSet => _, _} // warn import scala.collection.immutable.BitSet // OK def t = BitSet.empty @@ -265,4 +265,5 @@ package foo.test.typeapply.hklamdba.i16680: import foo.IO // OK def f[F[_]]: String = "hello" - def go = f[IO] \ No newline at end of file + def go = f[IO] +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503b.scala b/tests/neg/i15503b.scala index 4dc10e12606d..f828812dfe5b 100644 --- a/tests/neg/i15503b.scala +++ b/tests/neg/i15503b.scala @@ -5,13 +5,13 @@ val a = 1 // OK var cs = 3 // OK val b = // OK - var e3 = 2 // error - val e1 = 1 // error - def e2 = 2 // error + var e3 = 2 // warn + val e1 = 1 // warn + def e2 = 2 // warn 1 val c = // OK - var e1 = 1 // error not set + var e1 = 1 // warn not set def e2 = e1 // OK val e3 = e2 // OK e3 @@ -26,14 +26,14 @@ val g = // OK def d = 1 // OK def e = // OK - val e1 = 1 // error - def e2 = 2 // error - var e3 = 4 // error + val e1 = 1 // warn + def e2 = 2 // warn + var e3 = 4 // warn 1 def f = // OK val f1 = 1 // OK - var f2 = f1 // error not set + var f2 = f1 // warn not set def f3 = f2 // OK f3 @@ -50,13 +50,13 @@ class Foo { var cs = 3 // OK val b = // OK - var e3 = 2 // error - val e1 = 1 // error - def e2 = 2 // error + var e3 = 2 // warn + val e1 = 1 // warn + def e2 = 2 // warn 1 val c = // OK - var e1 = 1 // error not set + var e1 = 1 // warn not set def e2 = e1 // OK val e3 = e2 // OK e3 @@ -71,14 +71,14 @@ class Foo { def d = 1 // OK def e = // OK - val e1 = 1 // error - def e2 = 2 // error - var e3 = 4 // error + val e1 = 1 // warn + def e2 = 2 // warn + var e3 = 4 // warn 1 def f = // OK val f1 = 1 // OK - var f2 = f1 // error not set + var f2 = f1 // warn not set def f3 = f2 // OK f3 @@ -99,18 +99,18 @@ package foo.scala2.tests: trait Locals { def f0 = { - var x = 1 // error + var x = 1 // warn var y = 2 // OK y = 3 y + y } def f1 = { val a = new Outer // OK - val b = new Outer // error + val b = new Outer // warn new a.Inner } def f2 = { - var x = 100 // error not set + var x = 100 // warn not set x } } @@ -118,14 +118,14 @@ package foo.scala2.tests: object Types { def l1() = { object HiObject { def f = this } // OK - class Hi { // error + class Hi { // warn def f1: Hi = new Hi def f2(x: Hi) = x } - class DingDongDoobie // error + class DingDongDoobie // warn class Bippy // OK type Something = Bippy // OK - type OtherThing = String // error + type OtherThing = String // warn (new Bippy): Something } } @@ -142,3 +142,4 @@ package test.foo.twisted.i16682: isInt def f = myPackage("42") +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503c.scala b/tests/neg/i15503c.scala index b93ce8825114..6475302e2f1d 100644 --- a/tests/neg/i15503c.scala +++ b/tests/neg/i15503c.scala @@ -5,25 +5,25 @@ class A: class B: private[A] val a = 1 // OK private[B] val b = 1 // OK - private[this] val c = 1 // error - private val d = 1 // error + private[this] val c = 1 // warn + private val d = 1 // warn private[A] val e = 1 // OK private[this] val f = e // OK private val g = f // OK private[A] var h = 1 // OK - private[this] var i = h // error not set - private var j = i // error not set + private[this] var i = h // warn not set + private var j = i // warn not set private[this] var k = 1 // OK private var l = 2 // OK - private val m = // error + private val m = // warn k = l l = k l - private def fac(x: Int): Int = // error + private def fac(x: Int): Int = // warn if x == 0 then 1 else x * fac(x - 1) val x = 1 // OK @@ -34,10 +34,10 @@ class A: package foo.test.contructors: case class A private (x:Int) // OK class B private (val x: Int) // OK - class C private (private val x: Int) // error + class C private (private val x: Int) // warn class D private (private val x: Int): // OK def y = x - class E private (private var x: Int): // error not set + class E private (private var x: Int): // warn not set def y = x class F private (private var x: Int): // OK def y = @@ -55,3 +55,4 @@ package test.foo.i16682: } def f = myPackage.isInt("42") +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503d.scala b/tests/neg/i15503d.scala index c43dc07c638e..82e94e60ba75 100644 --- a/tests/neg/i15503d.scala +++ b/tests/neg/i15503d.scala @@ -8,12 +8,12 @@ case class S(pred: Const) extends Const case object Z extends Const val a = Sum(S(S(Z)),Z) match { - case Sum(a,Z) => Z // error + case Sum(a,Z) => Z // warn // case Sum(a @ _,Z) => Z // todo : this should pass in the future - case Sum(a@S(_),Z) => Z // error + case Sum(a@S(_),Z) => Z // warn case Sum(a@S(_),Z) => a // OK - case Sum(a@S(b@S(_)), Z) => a // error - case Sum(a@S(b@S(_)), Z) => a // error + case Sum(a@S(b@S(_)), Z) => a // warn + case Sum(a@S(b@S(_)), Z) => a // warn case Sum(a@S(b@(S(_))), Z) => Sum(a,b) // OK case Sum(_,_) => Z // OK case _ => Z // OK @@ -28,3 +28,4 @@ val a = Sum(S(S(Z)),Z) match { // val c = for { // case Some(x) <- Option(Option(1)) // } println(s"hello world") +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503e.scala b/tests/neg/i15503e.scala index f3214e7b24e6..84c5066dff57 100644 --- a/tests/neg/i15503e.scala +++ b/tests/neg/i15503e.scala @@ -5,10 +5,10 @@ object Foo { val default_val = 1 private def f1(a: Int) = a // OK - private def f2(a: Int) = default_val // error + private def f2(a: Int) = default_val // warn private def f3(a: Int)(using Int) = a // OK - private def f4(a: Int)(using Int) = default_val // error - private def f6(a: Int)(using Int) = summon[Int] // error + private def f4(a: Int)(using Int) = default_val // warn + private def f6(a: Int)(using Int) = summon[Int] // warn private def f7(a: Int)(using Int) = summon[Int] + a // OK } @@ -49,9 +49,9 @@ package foo.test.trivial: private def f6(x: Int) = X // OK private def f7(x: Int) = Y // OK private def f8(x: Int): List[C] = Nil // OK - private def f9(x: Int): List[Int] = List(1,2,3,4) // error + private def f9(x: Int): List[Int] = List(1,2,3,4) // warn private def foo:Int = 32 // OK - private def f77(x: Int) = foo // error + private def f77(x: Int) = foo // warn } object Y @@ -68,4 +68,4 @@ package foo.test.i16865: object Ex2 extends Bar: override def fn(a: Int, b: Int): Int = b + 3 // OK - +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503f.scala b/tests/neg/i15503f.scala index 08520d149b95..bea7cdf2a408 100644 --- a/tests/neg/i15503f.scala +++ b/tests/neg/i15503f.scala @@ -10,5 +10,7 @@ object Xd { private def f4(a: Int)(using Int) = default_int // OK private def f6(a: Int)(using Int) = summon[Int] // OK private def f7(a: Int)(using Int) = summon[Int] + a // OK - private def f8(a: Int)(using foo: Int) = a // error + private def f8(a: Int)(using foo: Int) = a // warn } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503g.scala b/tests/neg/i15503g.scala index 4da98a8d43f2..2f74c48cdbcc 100644 --- a/tests/neg/i15503g.scala +++ b/tests/neg/i15503g.scala @@ -5,10 +5,10 @@ object Foo { val default_int = 1 private def f1(a: Int) = a // OK - private def f2(a: Int) = default_int // error + private def f2(a: Int) = default_int // warn private def f3(a: Int)(using Int) = a // OK - private def f4(a: Int)(using Int) = default_int // error - private def f6(a: Int)(using Int) = summon[Int] // error + private def f4(a: Int)(using Int) = default_int // warn + private def f6(a: Int)(using Int) = summon[Int] // warn private def f7(a: Int)(using Int) = summon[Int] + a // OK /* --- Trivial method check --- */ private def g1(x: Int) = 1 // OK @@ -21,3 +21,4 @@ package foo.test.i17101: def value: A = x def causesIssue: Unit = println("oh no") } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503h.scala b/tests/neg/i15503h.scala index cef1f6cf566f..a384df26b5f9 100644 --- a/tests/neg/i15503h.scala +++ b/tests/neg/i15503h.scala @@ -1,20 +1,21 @@ //> using options -Xfatal-warnings -Wunused:linted -import collection.mutable.Set // error +import collection.mutable.Set // warn class A { - private val a = 1 // error + private val a = 1 // warn val b = 2 // OK - private def c = 2 // error + private def c = 2 // warn def d(using x:Int): Int = b // ok def e(x: Int) = 1 // OK def f = - val x = 1 // error - def f = 2 // error + val x = 1 // warn + def f = 2 // warn 3 def g(x: Int): Int = x match case x:1 => 0 // OK case _ => 1 -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503i.scala b/tests/neg/i15503i.scala index d415c95a701a..ff33e7cbb0c2 100644 --- a/tests/neg/i15503i.scala +++ b/tests/neg/i15503i.scala @@ -1,11 +1,11 @@ //> using options -Xfatal-warnings -Wunused:all -import collection.mutable.{Map => MutMap} // error -import collection.mutable.Set // error +import collection.mutable.{Map => MutMap} // warn +import collection.mutable.Set // warn class A { import collection.mutable.{Map => MutMap} // OK - private val a = 1 // error + private val a = 1 // warn val b = 2 // OK /* This goes around the trivial method detection */ @@ -13,7 +13,7 @@ class A { val someMap = MutMap() - private def c1 = 2 // error + private def c1 = 2 // warn private def c2 = 2 // OK def c3 = c2 @@ -23,8 +23,8 @@ class A { def e1(x: Int) = default_int // ok def e2(x: Int) = x // OK def f = - val x = 1 // error - def f = 2 // error + val x = 1 // warn + def f = 2 // warn val y = 3 // OK def g = 4 // OK y + g @@ -49,7 +49,7 @@ package foo.test.scala.annotation: def a3(@unused a: Int) = default_int //OK def b1 = - def f = 1 // error + def f = 1 // warn 1 def b2 = @@ -61,7 +61,7 @@ package foo.test.scala.annotation: 1 object Foo: - private def a = 1 // error + private def a = 1 // warn private def b = 2 // OK @unused private def c = 3 // OK @@ -81,8 +81,8 @@ package foo.test.i16678: def run = println(foo(number => number.toString, value = 5)) // OK - println(foo(number => "", value = 5)) // error - println(foo(func = number => "", value = 5)) // error + println(foo(number => "", value = 5)) // warn + println(foo(func = number => "", value = 5)) // warn println(foo(func = number => number.toString, value = 5)) // OK println(foo(func = _.toString, value = 5)) // OK @@ -93,7 +93,7 @@ package foo.test.possibleclasses: )( s: Int, val t: Int, // OK - private val z: Int // error + private val z: Int // warn ) case class AllCaseUsed( @@ -108,12 +108,12 @@ package foo.test.possibleclasses: } class AllClass( - k: Int, // error - private val y: Int // error + k: Int, // warn + private val y: Int // warn )( - s: Int, // error + s: Int, // warn val t: Int, // OK - private val z: Int // error + private val z: Int // warn ) class AllUsed( @@ -134,7 +134,7 @@ package foo.test.possibleclasses.withvar: )( s: Int, var t: Int, // OK - private var z: Int // error + private var z: Int // warn ) case class AllCaseUsed( @@ -143,27 +143,27 @@ package foo.test.possibleclasses.withvar: )( s: Int, // OK var t: Int, // OK global scope can be set somewhere else - private var z: Int // error not set + private var z: Int // warn not set ) { def a = k + y + s + t + z } class AllClass( - k: Int, // error - private var y: Int // error + k: Int, // warn + private var y: Int // warn )( - s: Int, // error + s: Int, // warn var t: Int, // OK - private var z: Int // error + private var z: Int // warn ) class AllUsed( k: Int, // OK - private var y: Int // error not set + private var y: Int // warn not set )( s: Int, // OK var t: Int, // OK global scope can be set somewhere else - private var z: Int // error not set + private var z: Int // warn not set ) { def a = k + y + s + t + z } @@ -313,3 +313,4 @@ package foo.test.i17117: val test = t1.test } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503j.scala b/tests/neg/i15503j.scala index 66140934abc1..2d40b5b49d24 100644 --- a/tests/neg/i15503j.scala +++ b/tests/neg/i15503j.scala @@ -12,8 +12,8 @@ package foo.unused.strict.test: import a.* // OK import a.x // OK import a.y // OK - import a.z // error - import a.f // error + import a.z // warn + import a.f // warn package c: import a.given // OK import a.x // OK @@ -56,4 +56,5 @@ package foo.unused.summon.inlines: new {} val b: B = summon[B] - val c: C = summon[C] \ No newline at end of file + val c: C = summon[C] +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15662.scala b/tests/neg/i15662.scala index 1b6070f26e00..366661c7bae4 100644 --- a/tests/neg/i15662.scala +++ b/tests/neg/i15662.scala @@ -4,7 +4,7 @@ case class Composite[T](v: T) def m(composite: Composite[_]): Unit = composite match { - case Composite[Int](v) => println(v) // error: cannot be checked at runtime + case Composite[Int](v) => println(v) // warn: cannot be checked at runtime } def m2(composite: Composite[_]): Unit = @@ -14,3 +14,5 @@ def m2(composite: Composite[_]): Unit = @main def Test = m(Composite("This is String")) + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15893.scala b/tests/neg/i15893.scala index d66da9ebec8b..79908e1e8615 100644 --- a/tests/neg/i15893.scala +++ b/tests/neg/i15893.scala @@ -25,19 +25,19 @@ transparent inline def transparentInlineMod2(inline n: NatT): NatT = inline n m case Succ(Succ(predPredN)) => transparentInlineMod2(predPredN) def dependentlyTypedMod2[N <: NatT](n: N): Mod2[N] = n match - case Zero(): Zero => Zero() // error - case Succ(Zero()): Succ[Zero] => Succ(Zero()) // error - case Succ(Succ(predPredN)): Succ[Succ[_]] => dependentlyTypedMod2(predPredN) // error + case Zero(): Zero => Zero() // warn + case Succ(Zero()): Succ[Zero] => Succ(Zero()) // warn + case Succ(Succ(predPredN)): Succ[Succ[_]] => dependentlyTypedMod2(predPredN) // warn inline def inlineDependentlyTypedMod2[N <: NatT](inline n: N): Mod2[N] = inline n match - case Zero(): Zero => Zero() // error - case Succ(Zero()): Succ[Zero] => Succ(Zero()) // error - case Succ(Succ(predPredN)): Succ[Succ[_]] => inlineDependentlyTypedMod2(predPredN) // error + case Zero(): Zero => Zero() // warn + case Succ(Zero()): Succ[Zero] => Succ(Zero()) // warn + case Succ(Succ(predPredN)): Succ[Succ[_]] => inlineDependentlyTypedMod2(predPredN) // warn transparent inline def transparentInlineDependentlyTypedMod2[N <: NatT](inline n: N): Mod2[N] = inline n match - case Zero(): Zero => Zero() // error - case Succ(Zero()): Succ[Zero] => Succ(Zero()) // error - case Succ(Succ(predPredN)): Succ[Succ[_]] => transparentInlineDependentlyTypedMod2(predPredN) // error + case Zero(): Zero => Zero() // warn + case Succ(Zero()): Succ[Zero] => Succ(Zero()) // warn + case Succ(Succ(predPredN)): Succ[Succ[_]] => transparentInlineDependentlyTypedMod2(predPredN) // warn def foo(n: NatT): NatT = mod2(n) match case Succ(Zero()) => Zero() @@ -61,3 +61,4 @@ inline def transparentInlineFoo(inline n: NatT): NatT = inline transparentInline 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 diff --git a/tests/neg/i16639a.scala b/tests/neg/i16639a.scala index 66db96901e74..907fed7f0765 100644 --- a/tests/neg/i16639a.scala +++ b/tests/neg/i16639a.scala @@ -2,34 +2,34 @@ // class Bippy(a: Int, b: Int) { private def this(c: Int) = this(c, c) // warn /Dotty:NoWarn - private def boop(x: Int) = x+a+b // error - private def bippy(x: Int): Int = bippy(x) // error TODO: could warn - final private val MILLIS1 = 2000 // error no warn, /Dotty:Warn - final private val MILLIS2: Int = 1000 // error + private def boop(x: Int) = x+a+b // warn + private def bippy(x: Int): Int = bippy(x) // warn TODO: could warn + final private val MILLIS1 = 2000 // warn no warn, /Dotty:Warn + final private val MILLIS2: Int = 1000 // warn final private val HI_COMPANION: Int = 500 // no warn, accessed from companion def hi() = Bippy.HI_INSTANCE } object Bippy { def hi(x: Bippy) = x.HI_COMPANION private val HI_INSTANCE: Int = 500 // no warn, accessed from instance - private val HEY_INSTANCE: Int = 1000 // error warn - private lazy val BOOL: Boolean = true // error warn + private val HEY_INSTANCE: Int = 1000 // warn warn + private lazy val BOOL: Boolean = true // warn warn } class A(val msg: String) class B1(msg: String) extends A(msg) class B2(msg0: String) extends A(msg0) -class B3(msg0: String) extends A("msg") // error /Dotty: unused explicit parameter +class B3(msg0: String) extends A("msg") // warn /Dotty: unused explicit parameter trait Bing trait Accessors { - private var v1: Int = 0 // error warn - private var v2: Int = 0 // error warn, never set + private var v1: Int = 0 // warn warn + private var v2: Int = 0 // warn warn, never set private var v3: Int = 0 private var v4: Int = 0 // no warn - private[this] var v5 = 0 // error warn, never set + private[this] var v5 = 0 // warn warn, never set private[this] var v6 = 0 private[this] var v7 = 0 // no warn @@ -43,12 +43,12 @@ trait Accessors { } class StableAccessors { - private var s1: Int = 0 // error warn - private var s2: Int = 0 // error warn, never set + private var s1: Int = 0 // warn warn + private var s2: Int = 0 // warn warn, never set private var s3: Int = 0 // warn, never got /Dotty: no warn even if not usued private var s4: Int = 0 // no warn - private[this] var s5 = 0 // error warn, never set + private[this] var s5 = 0 // warn warn, never set private[this] var s6 = 0 // no warn, limitation /Dotty: Why limitation ? private[this] var s7 = 0 // no warn @@ -75,27 +75,27 @@ class Outer { trait Locals { def f0 = { - var x = 1 // error warn + var x = 1 // warn warn var y = 2 y = 3 y + y } def f1 = { val a = new Outer // no warn - val b = new Outer // error warn + val b = new Outer // warn warn new a.Inner } def f2 = { - var x = 100 // error warn about it being a var, var not set + var x = 100 // warn warn about it being a var, var not set x } } object Types { private object Dongo { def f = this } // no more warn since #17061 - private class Bar1 // error warn + private class Bar1 // warn warn private class Bar2 // no warn - private type Alias1 = String // error warn + private type Alias1 = String // warn warn private type Alias2 = String // no warn def bippo = (new Bar2).toString @@ -103,14 +103,14 @@ object Types { def l1() = { object HiObject { def f = this } // no more warn since #17061 - class Hi { // error warn + class Hi { // warn warn def f1: Hi = new Hi def f2(x: Hi) = x } - class DingDongDoobie // error warn + class DingDongDoobie // warn warn class Bippy // no warn type Something = Bippy // no warn - type OtherThing = String // error warn + type OtherThing = String // warn warn (new Bippy): Something } } @@ -126,7 +126,7 @@ trait Underwarn { class OtherNames { private def x_=(i: Int): Unit = () // no more warn since #17061 - private def x: Int = 42 // error Dotty triggers unused private member : To investigate + private def x: Int = 42 // warn Dotty triggers unused private member : To investigate private def y_=(i: Int): Unit = () // // no more warn since #17061 private def y: Int = 42 @@ -152,7 +152,7 @@ trait Forever { } trait Ignorance { - private val readResolve = 42 // error ignore /dotty triggers unused private member/ why should we ignore ? + private val readResolve = 42 // warn ignore /dotty triggers unused private member/ why should we ignore ? } trait CaseyKasem { @@ -190,7 +190,7 @@ class `no warn in patmat anonfun isDefinedAt` { class `nonprivate alias is enclosing` { class C type C2 = C - private class D extends C2 // error warn + private class D extends C2 // warn warn } object `classof something` { @@ -200,8 +200,8 @@ object `classof something` { trait `short comings` { def f: Int = { - val x = 42 // error /Dotty only triggers in dotty + val x = 42 // warn /Dotty only triggers in dotty 17 } } - +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i16649-refutable.check b/tests/neg/i16649-refutable.check index a1325d7cfa91..b3e4e06624f2 100644 --- a/tests/neg/i16649-refutable.check +++ b/tests/neg/i16649-refutable.check @@ -1,8 +1,9 @@ --- Error: tests/neg/i16649-refutable.scala:6:6 ------------------------------------------------------------------------- -6 | val '{ ($y: Int) + ($z: Int) } = x // error +-- Warning: tests/neg/i16649-refutable.scala:6:6 ----------------------------------------------------------------------- +6 | val '{ ($y: Int) + ($z: Int) } = x // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | pattern binding uses refutable extractor `'{...}` | | 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. +No warnings can be incurred under -Werror. diff --git a/tests/neg/i16649-refutable.scala b/tests/neg/i16649-refutable.scala index 8caac5b2576a..62336caf87df 100644 --- a/tests/neg/i16649-refutable.scala +++ b/tests/neg/i16649-refutable.scala @@ -3,7 +3,9 @@ import quoted.* def foo(using Quotes)(x: Expr[Int]) = - val '{ ($y: Int) + ($z: Int) } = x // error + val '{ ($y: Int) + ($z: Int) } = x // warn val '{ $a: Int } = x val '{ $b: Any } = x val '{ $c } = x + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i16728.check b/tests/neg/i16728.check index 93cc215696c2..64f4f5c9de76 100644 --- a/tests/neg/i16728.check +++ b/tests/neg/i16728.check @@ -1,6 +1,7 @@ --- [E092] Pattern Match Error: tests/neg/i16728.scala:18:11 ------------------------------------------------------------ -18 | case tx : C[Int]#X => // error +-- [E092] Pattern Match Unchecked Warning: tests/neg/i16728.scala:18:11 ------------------------------------------------ +18 | case tx : C[Int]#X => // warn | ^ | the type test for C[Int] cannot be checked at runtime because its type arguments can't be determined from A | | longer explanation available when compiling with `-explain` +No warnings can be incurred under -Werror. diff --git a/tests/neg/i16728.scala b/tests/neg/i16728.scala index b76bb03fa14a..8d00b4fbea3b 100644 --- a/tests/neg/i16728.scala +++ b/tests/neg/i16728.scala @@ -15,7 +15,7 @@ object Test { val b0x : A[?]#X = new b0.X def test = b0x match { - case tx : C[Int]#X => // error + case tx : C[Int]#X => // warn val c : C[Int] = tx.outer c case _ => @@ -31,4 +31,6 @@ object Test { } } -} \ No newline at end of file +} + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i16876/Test.scala b/tests/neg/i16876/Test.scala index 2dd6bfb34421..71a01128990e 100644 --- a/tests/neg/i16876/Test.scala +++ b/tests/neg/i16876/Test.scala @@ -4,8 +4,7 @@ object Foo { private def myMethod(a: Int, b: Int, c: Int) = adder // ok myMethod(1, 2, 3) - private def myMethodFailing(a: Int, b: Int, c: Int) = a + 0 // error // error + private def myMethodFailing(a: Int, b: Int, c: Int) = a + 0 // warn // warn myMethodFailing(1, 2, 3) } - - +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i16930.scala b/tests/neg/i16930.scala index c7af60161424..6028b939813a 100644 --- a/tests/neg/i16930.scala +++ b/tests/neg/i16930.scala @@ -6,7 +6,7 @@ trait Outer: object Test { val outer: Outer = ??? - import outer.{Used, Unused} // error + import outer.{Used, Unused} // warn def foo(x: Any): Used = x.asInstanceOf[Used] } @@ -17,6 +17,7 @@ trait Outer1: object Test1 { val outer1: Outer1 = ??? - import outer1.{Unused1, UnusedToo1} // error // error + import outer1.{Unused1, UnusedToo1} // warn // warn def foo() = outer1.unusedToo1 // in this case UnusedToo1 is not used explicitly, only inferred } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i17266.check b/tests/neg/i17266.check index 1a84d1bf5e89..1cb89784ddcc 100644 --- a/tests/neg/i17266.check +++ b/tests/neg/i17266.check @@ -1,5 +1,5 @@ --- [E181] Potential Issue Error: tests/neg/i17266.scala:4:2 ------------------------------------------------------------ -4 | synchronized { // error +-- [E181] Potential Issue Warning: tests/neg/i17266.scala:4:2 ---------------------------------------------------------- +4 | synchronized { // warn | ^^^^^^^^^^^^ | Suspicious top-level unqualified call to synchronized |--------------------------------------------------------------------------------------------------------------------- @@ -9,8 +9,8 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. --------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Error: tests/neg/i17266.scala:17:2 ----------------------------------------------------------- -17 | synchronized { // error +-- [E181] Potential Issue Warning: tests/neg/i17266.scala:17:2 --------------------------------------------------------- +17 | synchronized { // warn | ^^^^^^^^^^^^ | Suspicious top-level unqualified call to synchronized |-------------------------------------------------------------------------------------------------------------------- @@ -20,8 +20,8 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. -------------------------------------------------------------------------------------------------------------------- --- [E187] Potential Issue Error: tests/neg/i17266.scala:22:4 ----------------------------------------------------------- -22 | 1.synchronized { // error +-- [E187] Potential Issue Warning: tests/neg/i17266.scala:22:4 --------------------------------------------------------- +22 | 1.synchronized { // warn | ^^^^^^^^^^^^^^ | Suspicious synchronized call on boxed class |-------------------------------------------------------------------------------------------------------------------- @@ -30,8 +30,8 @@ | You called the synchronized method on a boxed primitive. This might not be what | you intended. -------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Error: tests/neg/i17266.scala:108:2 ---------------------------------------------------------- -108 | wait() // error +-- [E181] Potential Issue Warning: tests/neg/i17266.scala:108:2 -------------------------------------------------------- +108 | wait() // warn | ^^^^ | Suspicious top-level unqualified call to wait |------------------------------------------------------------------------------------------------------------------- @@ -41,8 +41,8 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Error: tests/neg/i17266.scala:115:2 ---------------------------------------------------------- -115 | wait() // error +-- [E181] Potential Issue Warning: tests/neg/i17266.scala:115:2 -------------------------------------------------------- +115 | wait() // warn | ^^^^ | Suspicious top-level unqualified call to wait |------------------------------------------------------------------------------------------------------------------- @@ -52,8 +52,8 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Error: tests/neg/i17266.scala:121:2 ---------------------------------------------------------- -121 | wait(10) // error +-- [E181] Potential Issue Warning: tests/neg/i17266.scala:121:2 -------------------------------------------------------- +121 | wait(10) // warn | ^^^^ | Suspicious top-level unqualified call to wait |------------------------------------------------------------------------------------------------------------------- @@ -63,8 +63,8 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Error: tests/neg/i17266.scala:128:2 ---------------------------------------------------------- -128 | wait(10) // error +-- [E181] Potential Issue Warning: tests/neg/i17266.scala:128:2 -------------------------------------------------------- +128 | wait(10) // warn | ^^^^ | Suspicious top-level unqualified call to wait |------------------------------------------------------------------------------------------------------------------- @@ -74,8 +74,8 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Error: tests/neg/i17266.scala:134:2 ---------------------------------------------------------- -134 | hashCode() // error +-- [E181] Potential Issue Warning: tests/neg/i17266.scala:134:2 -------------------------------------------------------- +134 | hashCode() // warn | ^^^^^^^^ | Suspicious top-level unqualified call to hashCode |------------------------------------------------------------------------------------------------------------------- @@ -85,8 +85,8 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Error: tests/neg/i17266.scala:141:2 ---------------------------------------------------------- -141 | hashCode() // error +-- [E181] Potential Issue Warning: tests/neg/i17266.scala:141:2 -------------------------------------------------------- +141 | hashCode() // warn | ^^^^^^^^ | Suspicious top-level unqualified call to hashCode |------------------------------------------------------------------------------------------------------------------- @@ -96,3 +96,4 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- +No warnings can be incurred under -Werror. diff --git a/tests/neg/i17266.scala b/tests/neg/i17266.scala index 439abafc44a1..23ed825e285c 100644 --- a/tests/neg/i17266.scala +++ b/tests/neg/i17266.scala @@ -1,7 +1,7 @@ //> using options -Werror -explain def test1 = - synchronized { // error + synchronized { // warn println("hello") } @@ -14,12 +14,12 @@ object MyLib def test3 = import MyLib.* - synchronized { // error + synchronized { // warn println("hello") } def test4 = - 1.synchronized { // error + 1.synchronized { // warn println("hello") } @@ -105,40 +105,41 @@ trait Test15: } def test16 = - wait() // error + wait() // warn def test17 = this.wait() // not an error (should be?) def test18 = import MyLib.* - wait() // error + wait() // warn def test19 = 1.wait() // not an error (should be?) def test20 = - wait(10) // error + wait(10) // warn def test21 = this.wait(10) // not an error (should be?) def test22 = import MyLib.* - wait(10) // error + wait(10) // warn def test23 = 1.wait(10) // not an error (should be?) def test24 = - hashCode() // error + hashCode() // warn def test25 = this.hashCode() // not an error (should be?) def test26 = import MyLib.* - hashCode() // error + 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 diff --git a/tests/neg/i17314b.scala b/tests/neg/i17314b.scala index 9e89fecde935..be7fda4682f7 100644 --- a/tests/neg/i17314b.scala +++ b/tests/neg/i17314b.scala @@ -6,9 +6,11 @@ package foo: package bar: - import foo.{given foo.Foo[Int]} // error + import foo.{given foo.Foo[Int]} // warn import foo.Foo given Foo[Int] = ??? val repro: Foo[Int] = summon[Foo[Int]] + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i17612a.check b/tests/neg/i17612a.check index 04a5b07b6e33..48e5b9c17be9 100644 --- a/tests/neg/i17612a.check +++ b/tests/neg/i17612a.check @@ -1,32 +1,33 @@ --- Error: tests/neg/i17612a.scala:18:15 -------------------------------------------------------------------------------- -18 | class Derived(x : Int, y: Int, z2: Int) extends Base(x, y + 1, z2): // error // error / for x, y translated to private[this] x field & shadowing var Base.x, Base.y +-- Warning: tests/neg/i17612a.scala:18:15 ------------------------------------------------------------------------------ +18 | class Derived(x : Int, y: Int, z2: Int) extends Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y | ^ | value x in class Derived shadows field x inherited from class Base --- Error: tests/neg/i17612a.scala:18:24 -------------------------------------------------------------------------------- -18 | class Derived(x : Int, y: Int, z2: Int) extends Base(x, y + 1, z2): // error // error / for x, y translated to private[this] x field & shadowing var Base.x, Base.y +-- Warning: tests/neg/i17612a.scala:18:24 ------------------------------------------------------------------------------ +18 | class Derived(x : Int, y: Int, z2: Int) extends Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y | ^ | value y in class Derived shadows field y inherited from class Base --- Error: tests/neg/i17612a.scala:20:2 --------------------------------------------------------------------------------- -20 | private val shadowed2 = 2 + 2 // error (In Scala 2 we cannot do that got the warning) +-- Warning: tests/neg/i17612a.scala:20:2 ------------------------------------------------------------------------------- +20 | private val shadowed2 = 2 + 2 // warn (In Scala 2 we cannot do that got the warning) | ^ | value shadowed2 in class Derived shadows field shadowed2 inherited from class Base --- Error: tests/neg/i17612a.scala:21:2 --------------------------------------------------------------------------------- -21 | private[this] val shadowed3 = 3 + 3 // error +-- Warning: tests/neg/i17612a.scala:21:2 ------------------------------------------------------------------------------- +21 | private[this] val shadowed3 = 3 + 3 // warn | ^ | value shadowed3 in class Derived shadows field shadowed3 inherited from class Base --- Error: tests/neg/i17612a.scala:23:2 --------------------------------------------------------------------------------- -23 | private val shadowed5 = 5 + 5 // error +-- Warning: tests/neg/i17612a.scala:23:2 ------------------------------------------------------------------------------- +23 | private val shadowed5 = 5 + 5 // warn | ^ | value shadowed5 in class Derived shadows field shadowed5 inherited from class Base --- Error: tests/neg/i17612a.scala:34:20 -------------------------------------------------------------------------------- -34 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // error // error // error +-- Warning: tests/neg/i17612a.scala:34:20 ------------------------------------------------------------------------------ +34 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // warn // warn // warn | ^ | value x in class UnderDerived shadows field x inherited from class Base --- Error: tests/neg/i17612a.scala:34:28 -------------------------------------------------------------------------------- -34 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // error // error // error +-- Warning: tests/neg/i17612a.scala:34:28 ------------------------------------------------------------------------------ +34 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // warn // warn // warn | ^ | value y in class UnderDerived shadows field y inherited from class Base --- Error: tests/neg/i17612a.scala:34:36 -------------------------------------------------------------------------------- -34 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // error // error // error +-- Warning: tests/neg/i17612a.scala:34:36 ------------------------------------------------------------------------------ +34 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // warn // warn // warn | ^ | value z in class UnderDerived shadows field z inherited from class Base +No warnings can be incurred under -Werror. diff --git a/tests/neg/i17612a.scala b/tests/neg/i17612a.scala index 1145cd76edc0..5aba92b095f3 100644 --- a/tests/neg/i17612a.scala +++ b/tests/neg/i17612a.scala @@ -15,12 +15,12 @@ object i17612a: def increment(): Unit = x = x + 1 - class Derived(x : Int, y: Int, z2: Int) extends Base(x, y + 1, z2): // error // error / for x, y translated to private[this] x field & shadowing var Base.x, Base.y + class Derived(x : Int, y: Int, z2: Int) extends Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y private def hello() = 4 - private val shadowed2 = 2 + 2 // error (In Scala 2 we cannot do that got the warning) - private[this] val shadowed3 = 3 + 3 // error + private val shadowed2 = 2 + 2 // warn (In Scala 2 we cannot do that got the warning) + private[this] val shadowed3 = 3 + 3 // warn //private[Derived] val fatalOverride = 0 // value fatalOverride of type Int has weaker access privileges; it should be public - private val shadowed5 = 5 + 5 // error + private val shadowed5 = 5 + 5 // warn private val notShadowed2 = -4 //protected var shadowed6 = 6 + 6 // variable shadowed6 of type Int has weaker access privileges; it should be public @@ -31,7 +31,7 @@ object i17612a: override def toString = s"x : ${x.toString}, y : ${y.toString}" - class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // error // error // error + class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // warn // warn // warn def main(args: Array[String]) = val derived = new Derived(1, 1, 1) @@ -39,4 +39,5 @@ object i17612a: derived.increment() println(derived.toString) // still x: '1', probably unexpected, for y it never prints the super value, less surprising println(derived.shadowed2) - println(derived.shadowed3) \ No newline at end of file + println(derived.shadowed3) +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i17612b.check b/tests/neg/i17612b.check index 75e8b7312833..ae5b071d6187 100644 --- a/tests/neg/i17612b.check +++ b/tests/neg/i17612b.check @@ -1,32 +1,33 @@ --- Error: tests/neg/i17612b/i17612b.scala:21:15 ------------------------------------------------------------------------ -21 | class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // error // error / for x, y translated to private[this] x field & shadowing var Base.x, Base.y +-- Warning: tests/neg/i17612b/i17612b.scala:21:15 ---------------------------------------------------------------------- +21 | class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y | ^ | value x in class Derived shadows field x inherited from trait Base --- Error: tests/neg/i17612b/i17612b.scala:21:33 ------------------------------------------------------------------------ -21 | class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // error // error / for x, y translated to private[this] x field & shadowing var Base.x, Base.y +-- Warning: tests/neg/i17612b/i17612b.scala:21:33 ---------------------------------------------------------------------- +21 | class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y | ^ | value y in class Derived shadows field y inherited from trait Base --- Error: tests/neg/i17612b/i17612b.scala:23:2 ------------------------------------------------------------------------- -23 | private val shadowed2 = 2 + 2 // error (In Scala 2 we cannot do that got the warning) +-- Warning: tests/neg/i17612b/i17612b.scala:23:2 ----------------------------------------------------------------------- +23 | private val shadowed2 = 2 + 2 // warn (In Scala 2 we cannot do that got the warning) | ^ | value shadowed2 in class Derived shadows field shadowed2 inherited from trait Base --- Error: tests/neg/i17612b/i17612b.scala:24:2 ------------------------------------------------------------------------- -24 | private[this] val shadowed3 = 3 + 3 // error +-- Warning: tests/neg/i17612b/i17612b.scala:24:2 ----------------------------------------------------------------------- +24 | private[this] val shadowed3 = 3 + 3 // warn | ^ | value shadowed3 in class Derived shadows field shadowed3 inherited from trait Base --- Error: tests/neg/i17612b/i17612b.scala:26:2 ------------------------------------------------------------------------- -26 | private val shadowed5 = 5 + 5 // error +-- Warning: tests/neg/i17612b/i17612b.scala:26:2 ----------------------------------------------------------------------- +26 | private val shadowed5 = 5 + 5 // warn | ^ | value shadowed5 in class Derived shadows field shadowed5 inherited from trait Base --- Error: tests/neg/i17612b/i17612b.scala:41:20 ------------------------------------------------------------------------ -41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // error // error // error +-- Warning: tests/neg/i17612b/i17612b.scala:41:20 ---------------------------------------------------------------------- +41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // warn // warn // warn | ^ | value x in class UnderDerived shadows field x inherited from trait Base --- Error: tests/neg/i17612b/i17612b.scala:41:28 ------------------------------------------------------------------------ -41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // error // error // error +-- Warning: tests/neg/i17612b/i17612b.scala:41:28 ---------------------------------------------------------------------- +41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // warn // warn // warn | ^ | value y in class UnderDerived shadows field y inherited from trait Base --- Error: tests/neg/i17612b/i17612b.scala:41:36 ------------------------------------------------------------------------ -41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // error // error // error +-- Warning: tests/neg/i17612b/i17612b.scala:41:36 ---------------------------------------------------------------------- +41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // warn // warn // warn | ^ | value z in class UnderDerived shadows field z inherited from trait Base +No warnings can be incurred under -Werror. diff --git a/tests/neg/i17612b/i17612b.scala b/tests/neg/i17612b/i17612b.scala index b59352f562d0..9b0fa7cf6259 100644 --- a/tests/neg/i17612b/i17612b.scala +++ b/tests/neg/i17612b/i17612b.scala @@ -18,12 +18,12 @@ object i17612b: trait BaseB trait BaseC(var x2: Int) - class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // error // error / for x, y translated to private[this] x field & shadowing var Base.x, Base.y + class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y private def hello() = 4 - private val shadowed2 = 2 + 2 // error (In Scala 2 we cannot do that got the warning) - private[this] val shadowed3 = 3 + 3 // error + private val shadowed2 = 2 + 2 // warn (In Scala 2 we cannot do that got the warning) + private[this] val shadowed3 = 3 + 3 // warn - private val shadowed5 = 5 + 5 // error + private val shadowed5 = 5 + 5 // warn private val notShadowed2 = -4 val lambda: Int => Int => Int = @@ -38,7 +38,8 @@ object i17612b: override def toString = s"x : ${x.toString}, y : ${y.toString}" - class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // error // error // error + class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // warn // warn // warn def main(args: Array[String]) = val derived = new Derived(1, 1, 1, 1) +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i17613a.check b/tests/neg/i17613a.check index 4721b786c82d..eccafae81427 100644 --- a/tests/neg/i17613a.check +++ b/tests/neg/i17613a.check @@ -1,28 +1,29 @@ --- Error: tests/neg/i17613a.scala:8:13 --------------------------------------------------------------------------------- -8 | def foobar[D](in: D) = in.toString // error method parameter shadows some other type +-- Warning: tests/neg/i17613a.scala:8:13 ------------------------------------------------------------------------------- +8 | def foobar[D](in: D) = in.toString // warn method parameter shadows some other type | ^ | Type parameter D for method foobar shadows the type defined by trait D in class B --- Error: tests/neg/i17613a.scala:9:13 --------------------------------------------------------------------------------- -9 | type MySeq[D] = Seq[D] // error type member's parameter shadows some other type +-- Warning: tests/neg/i17613a.scala:9:13 ------------------------------------------------------------------------------- +9 | type MySeq[D] = Seq[D] // warn type member's parameter shadows some other type | ^ | Type parameter D for type MySeq shadows the type defined by trait D in class B --- Error: tests/neg/i17613a.scala:11:12 -------------------------------------------------------------------------------- -11 | class Foo[T](t: T): // error class parameter shadows some other type +-- Warning: tests/neg/i17613a.scala:11:12 ------------------------------------------------------------------------------ +11 | class Foo[T](t: T): // warn class parameter shadows some other type | ^ | Type parameter T for class Foo shadows the type defined by type T in class B --- Error: tests/neg/i17613a.scala:12:11 -------------------------------------------------------------------------------- -12 | def bar[T](w: T) = w.toString // error a type parameter shadows another type parameter +-- Warning: tests/neg/i17613a.scala:12:11 ------------------------------------------------------------------------------ +12 | def bar[T](w: T) = w.toString // warn a type parameter shadows another type parameter | ^ | Type parameter T for method bar shadows the type defined by type T in class Foo --- Error: tests/neg/i17613a.scala:15:12 -------------------------------------------------------------------------------- -15 | class C[M[List[_]]] // error +-- Warning: tests/neg/i17613a.scala:15:12 ------------------------------------------------------------------------------ +15 | class C[M[List[_]]] // warn | ^^^^^^^ | Type parameter List for class C shadows the type defined by type List in package scala --- Error: tests/neg/i17613a.scala:16:11 -------------------------------------------------------------------------------- -16 | type E[M[List[_]]] = Int // error +-- Warning: tests/neg/i17613a.scala:16:11 ------------------------------------------------------------------------------ +16 | type E[M[List[_]]] = Int // warn | ^^^^^^^ | Type parameter List for type E shadows the type defined by type List in package scala --- Error: tests/neg/i17613a.scala:17:14 -------------------------------------------------------------------------------- -17 | def foo[N[M[List[_]]]] = ??? // error +-- Warning: tests/neg/i17613a.scala:17:14 ------------------------------------------------------------------------------ +17 | def foo[N[M[List[_]]]] = ??? // warn | ^^^^^^^ | Type parameter List for method foo shadows the type defined by type List in package scala +No warnings can be incurred under -Werror. diff --git a/tests/neg/i17613a.scala b/tests/neg/i17613a.scala index d0e413098cec..e161c5908297 100644 --- a/tests/neg/i17613a.scala +++ b/tests/neg/i17613a.scala @@ -5,19 +5,20 @@ object i17613a: type T = Int trait D - def foobar[D](in: D) = in.toString // error method parameter shadows some other type - type MySeq[D] = Seq[D] // error type member's parameter shadows some other type + def foobar[D](in: D) = in.toString // warn method parameter shadows some other type + type MySeq[D] = Seq[D] // warn type member's parameter shadows some other type - class Foo[T](t: T): // error class parameter shadows some other type - def bar[T](w: T) = w.toString // error a type parameter shadows another type parameter + class Foo[T](t: T): // warn class parameter shadows some other type + def bar[T](w: T) = w.toString // warn a type parameter shadows another type parameter // even deeply nested... - class C[M[List[_]]] // error - type E[M[List[_]]] = Int // error - def foo[N[M[List[_]]]] = ??? // error + class C[M[List[_]]] // warn + type E[M[List[_]]] = Int // warn + def foo[N[M[List[_]]]] = ??? // warn // ...but not between type parameters in the same list class F[A, M[N[A]]] type G[A, M[L[A]]] = Int def bar[A, N[M[L[A]]]] = ??? def main(args: Array[String]) = println("Test for type parameter shadow") +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i17613b/i17613b.scala b/tests/neg/i17613b/i17613b.scala index b0c4f11b949c..a5c0eaacc20f 100644 --- a/tests/neg/i17613b/i17613b.scala +++ b/tests/neg/i17613b/i17613b.scala @@ -6,39 +6,40 @@ object i17613b: type T = Int trait D - def foobar[ImTrait](in: D) = in.toString // error - type MySeq[ImTrait] = Seq[D] // error + def foobar[ImTrait](in: D) = in.toString // warn + type MySeq[ImTrait] = Seq[D] // warn - def foobar2[ImClass](in: D) = in.toString // error - type MySeq2[ImClass] = Seq[D] // error + def foobar2[ImClass](in: D) = in.toString // warn + type MySeq2[ImClass] = Seq[D] // warn - given [A]: Ordering[Int]() - type TypeLambda[A] = [ImTrait] =>> Map[ImTrait, B] // error - type PolyFun[A] = [ImTrait] => ImTrait => B // error + given [A]: Ordering[Int]() // error + type TypeLambda[A] = [ImTrait] =>> Map[ImTrait, B] + type PolyFun[A] = [ImTrait] => ImTrait => B // warn type MatchType[A] = A match { case String => Int case ImTrait => Boolean } - class Foo[T](t: T): // error class parameter shadows some other type + class Foo[T](t: T): // warn class parameter shadows some other type import scala.collection.immutable.{List => List1} def bar[List](w: T) = w.toString // no warning due to the explicit import renaming - def intType[List1](x: T) = x.toString() // error + def intType[List1](x: T) = x.toString() // warn type Y[List] = Int // no warning given [A]: Ordering[A]() - given [Int]: Ordering[Int]() // error + given [Int]: Ordering[Int]() // warn - class C[M[List[_]]] // error List not renamed here - type E[M[Int[_]]] = Int // error + class C[M[List[_]]] // warn List not renamed here + type E[M[Int[_]]] = Int // warn - def foo[N[M[List[_]]]] = // error + def foo[N[M[List[_]]]] = // warn import importTry.{ImClass => ImClassR} def inner[ImClass] = // no warning - type Z[ImClassR] = Int // error - class InnerCl[ImClassR] // error + type Z[ImClassR] = Int // warn + class InnerCl[ImClassR] // warn 5 - def main(args: Array[String]) = println("Test for type parameter shadow") \ No newline at end of file + def main(args: Array[String]) = println("Test for type parameter shadow") +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i18722.check b/tests/neg/i18722.check index 539e23787752..d6ebf3d6b474 100644 --- a/tests/neg/i18722.check +++ b/tests/neg/i18722.check @@ -1,5 +1,5 @@ --- [E190] Potential Issue Error: tests/neg/i18722.scala:3:15 ----------------------------------------------------------- -3 |def f1: Unit = null // error +-- [E190] Potential Issue Warning: tests/neg/i18722.scala:3:15 --------------------------------------------------------- +3 |def f1: Unit = null // warn | ^^^^ | Discarded non-Unit value of type Null. You may want to use `()`. |--------------------------------------------------------------------------------------------------------------------- @@ -9,8 +9,8 @@ | Here the `null` expression is a pure statement that can be discarded. | Therefore the expression is effectively equivalent to `()`. --------------------------------------------------------------------------------------------------------------------- --- [E190] Potential Issue Error: tests/neg/i18722.scala:4:15 ----------------------------------------------------------- -4 |def f2: Unit = 1 // error +-- [E190] Potential Issue Warning: tests/neg/i18722.scala:4:15 --------------------------------------------------------- +4 |def f2: Unit = 1 // warn | ^ | Discarded non-Unit value of type Int. You may want to use `()`. |--------------------------------------------------------------------------------------------------------------------- @@ -20,8 +20,8 @@ | Here the `1` expression is a pure statement that can be discarded. | Therefore the expression is effectively equivalent to `()`. --------------------------------------------------------------------------------------------------------------------- --- [E190] Potential Issue Error: tests/neg/i18722.scala:5:15 ----------------------------------------------------------- -5 |def f3: Unit = "a" // error +-- [E190] Potential Issue Warning: tests/neg/i18722.scala:5:15 --------------------------------------------------------- +5 |def f3: Unit = "a" // warn | ^^^ | Discarded non-Unit value of type String. You may want to use `()`. |--------------------------------------------------------------------------------------------------------------------- @@ -31,8 +31,8 @@ | Here the `"a"` expression is a pure statement that can be discarded. | Therefore the expression is effectively equivalent to `()`. --------------------------------------------------------------------------------------------------------------------- --- [E190] Potential Issue Error: tests/neg/i18722.scala:7:15 ----------------------------------------------------------- -7 |def f4: Unit = i // error +-- [E190] Potential Issue Warning: tests/neg/i18722.scala:7:15 --------------------------------------------------------- +7 |def f4: Unit = i // warn | ^ | Discarded non-Unit value of type Int. You may want to use `()`. |--------------------------------------------------------------------------------------------------------------------- @@ -42,3 +42,4 @@ | Here the `i` expression is a pure statement that can be discarded. | Therefore the expression is effectively equivalent to `()`. --------------------------------------------------------------------------------------------------------------------- +No warnings can be incurred under -Werror. diff --git a/tests/neg/i18722.scala b/tests/neg/i18722.scala index c68390b76201..1c32aae3ae26 100644 --- a/tests/neg/i18722.scala +++ b/tests/neg/i18722.scala @@ -1,9 +1,10 @@ //> using options -Werror -explain -def f1: Unit = null // error -def f2: Unit = 1 // error -def f3: Unit = "a" // error +def f1: Unit = null // warn +def f2: Unit = 1 // warn +def f3: Unit = "a" // warn val i: Int = 1 -def f4: Unit = i // error +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 diff --git a/tests/neg/i2333.scala b/tests/neg/i2333.scala index 67cddbc73f48..5cbf8fcd40cb 100644 --- a/tests/neg/i2333.scala +++ b/tests/neg/i2333.scala @@ -6,6 +6,7 @@ } object Test { - new Foo // error: deprecated - new Foo(1) // error: deprecated -} \ No newline at end of file + new Foo // warn: deprecated + new Foo(1) // warn: deprecated +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i2673.scala b/tests/neg/i2673.scala index 62c787fa00fb..77abe1a06d16 100644 --- a/tests/neg/i2673.scala +++ b/tests/neg/i2673.scala @@ -2,5 +2,7 @@ package Foos -class Foo // error +class Foo // warn class foo + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i2673b.scala b/tests/neg/i2673b.scala index 26e09ec3297e..6481ab469943 100644 --- a/tests/neg/i2673b.scala +++ b/tests/neg/i2673b.scala @@ -2,5 +2,7 @@ package Foos -class Bar // error +class Bar // warn object bar + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i2673c.scala b/tests/neg/i2673c.scala index 575d8c25d9e0..46e8ff828c18 100644 --- a/tests/neg/i2673c.scala +++ b/tests/neg/i2673c.scala @@ -3,6 +3,8 @@ package Foos object Outer { - case class X() // error + case class X() // warn object x } + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i3561.scala b/tests/neg/i3561.scala index 862e65f3c2f7..0a19e01e8ab6 100644 --- a/tests/neg/i3561.scala +++ b/tests/neg/i3561.scala @@ -2,17 +2,18 @@ class Test { val Constant = 'Q' // OK if final - def tokenMe(ch: Char) = (ch: @annotation.switch) match { // error: could not emit switch + def tokenMe(ch: Char) = (ch: @annotation.switch) match { // warn: could not emit switch case ' ' => 1 case 'A' => 2 case '5' | Constant => 3 case '4' => 4 } - def test2(x: Any) = (x: @annotation.switch) match { // error: could not emit switch + def test2(x: Any) = (x: @annotation.switch) match { // warn: could not emit switch case ' ' => 1 case 'A' => 2 case '5' | Constant => 3 case '4' => 4 } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i4008.check b/tests/neg/i4008.check index c1f27866d1c1..accc8b0d29b2 100644 --- a/tests/neg/i4008.check +++ b/tests/neg/i4008.check @@ -1,40 +1,41 @@ --- [E158] Reference Error: tests/neg/i4008.scala:7:56 ------------------------------------------------------------------ -7 |@annotation.implicitNotFound("An implicit ShouldWarn1[${B}] is not in scope") // error +-- [E158] Reference Warning: tests/neg/i4008.scala:7:56 ---------------------------------------------------------------- +7 |@annotation.implicitNotFound("An implicit ShouldWarn1[${B}] is not in scope") // warn | ^ | Invalid reference to a type variable `B` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn1`. --- [E158] Reference Error: tests/neg/i4008.scala:11:56 ----------------------------------------------------------------- -11 |@annotation.implicitNotFound("An implicit ShouldWarn2[${A}] is not in scope") // error +-- [E158] Reference Warning: tests/neg/i4008.scala:11:56 --------------------------------------------------------------- +11 |@annotation.implicitNotFound("An implicit ShouldWarn2[${A}] is not in scope") // warn | ^ | Invalid reference to a type variable `A` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn2`. --- [E158] Reference Error: tests/neg/i4008.scala:15:56 ----------------------------------------------------------------- -15 |@annotation.implicitNotFound("An implicit ShouldWarn3[${A},${B}] is not in scope") // error +-- [E158] Reference Warning: tests/neg/i4008.scala:15:56 --------------------------------------------------------------- +15 |@annotation.implicitNotFound("An implicit ShouldWarn3[${A},${B}] is not in scope") // warn | ^ | Invalid reference to a type variable `A` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn3`. --- [E158] Reference Error: tests/neg/i4008.scala:19:56 ----------------------------------------------------------------- -19 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // error // error +-- [E158] Reference Warning: tests/neg/i4008.scala:19:56 --------------------------------------------------------------- +19 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // warn // warn | ^ | Invalid reference to a type variable `A` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn4`. --- [E158] Reference Error: tests/neg/i4008.scala:19:61 ----------------------------------------------------------------- -19 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // error // error +-- [E158] Reference Warning: tests/neg/i4008.scala:19:61 --------------------------------------------------------------- +19 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // warn // warn | ^ | Invalid reference to a type variable `B` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn4`. --- [E158] Reference Error: tests/neg/i4008.scala:23:61 ----------------------------------------------------------------- -23 |@annotation.implicitNotFound("An implicit ShouldWarn5[${C},${Abc}] is not in scope") // error +-- [E158] Reference Warning: tests/neg/i4008.scala:23:61 --------------------------------------------------------------- +23 |@annotation.implicitNotFound("An implicit ShouldWarn5[${C},${Abc}] is not in scope") // warn | ^ | Invalid reference to a type variable `Abc` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn5`. --- [E158] Reference Error: tests/neg/i4008.scala:46:54 ----------------------------------------------------------------- -46 |class C[A](using @annotation.implicitNotFound("No C[${B}] found") c: Class[A]) // error +-- [E158] Reference Warning: tests/neg/i4008.scala:46:54 --------------------------------------------------------------- +46 |class C[A](using @annotation.implicitNotFound("No C[${B}] found") c: Class[A]) // warn | ^ | Invalid reference to a type variable `B` found in the annotation argument. | The variable does not occur as a parameter in the scope of the constructor of `C`. --- [E158] Reference Error: tests/neg/i4008.scala:48:62 ----------------------------------------------------------------- -48 |def someMethod1[A](using @annotation.implicitNotFound("No C[${B}] found") sc: C[A]) = 0 // error +-- [E158] Reference Warning: tests/neg/i4008.scala:48:62 --------------------------------------------------------------- +48 |def someMethod1[A](using @annotation.implicitNotFound("No C[${B}] found") sc: C[A]) = 0 // warn | ^ | Invalid reference to a type variable `B` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `someMethod1`. +No warnings can be incurred under -Werror. diff --git a/tests/neg/i4008.scala b/tests/neg/i4008.scala index 5b851c987e37..fb24c25fc4ff 100644 --- a/tests/neg/i4008.scala +++ b/tests/neg/i4008.scala @@ -4,23 +4,23 @@ // class, 1TP, invalid ref -@annotation.implicitNotFound("An implicit ShouldWarn1[${B}] is not in scope") // error +@annotation.implicitNotFound("An implicit ShouldWarn1[${B}] is not in scope") // warn class ShouldWarn1[A] // trait, 1TP, invalid ref -@annotation.implicitNotFound("An implicit ShouldWarn2[${A}] is not in scope") // error +@annotation.implicitNotFound("An implicit ShouldWarn2[${A}] is not in scope") // warn trait ShouldWarn2[B] // trait, 2TP, 1 invalid ref -@annotation.implicitNotFound("An implicit ShouldWarn3[${A},${B}] is not in scope") // error +@annotation.implicitNotFound("An implicit ShouldWarn3[${A},${B}] is not in scope") // warn trait ShouldWarn3[B, C] // class, 2TP, 2 invalid refs -@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // error // error +@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // warn // warn class ShouldWarn4[C, D] // class, 2TP, 1 invalid multi-char refs -@annotation.implicitNotFound("An implicit ShouldWarn5[${C},${Abc}] is not in scope") // error +@annotation.implicitNotFound("An implicit ShouldWarn5[${C},${Abc}] is not in scope") // warn class ShouldWarn5[C, D] // trait, 1TP, valid ref @@ -43,8 +43,9 @@ class ShouldntWarn4[Hello, World] @annotation.implicitNotFound("Hopefully you don't see this!") -class C[A](using @annotation.implicitNotFound("No C[${B}] found") c: Class[A]) // error +class C[A](using @annotation.implicitNotFound("No C[${B}] found") c: Class[A]) // warn -def someMethod1[A](using @annotation.implicitNotFound("No C[${B}] found") sc: C[A]) = 0 // error +def someMethod1[A](using @annotation.implicitNotFound("No C[${B}] found") sc: C[A]) = 0 // warn -def someMethod2[A](using @annotation.implicitNotFound("No C[${A}] found") sc: C[A]) = "" \ No newline at end of file +def someMethod2[A](using @annotation.implicitNotFound("No C[${A}] found") sc: C[A]) = "" +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i4364.scala b/tests/neg/i4364.scala index 85dca443f6d4..225fd1dd0384 100644 --- a/tests/neg/i4364.scala +++ b/tests/neg/i4364.scala @@ -6,6 +6,8 @@ object Test { def main(args: Array[String]) = { foo(f) // Ok: Consumer is @FunctionalInterface - new java.io.ObjectOutputStream(f) // error: OutputStream is not @FunctionalInterface + new java.io.ObjectOutputStream(f) // warn: OutputStream is not @FunctionalInterface } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i4812.check b/tests/neg/i4812.check index f4aee0e35dde..fccaa62f0c80 100644 --- a/tests/neg/i4812.check +++ b/tests/neg/i4812.check @@ -1,42 +1,43 @@ --- [E092] Pattern Match Error: tests/neg/i4812.scala:8:11 -------------------------------------------------------------- -8 | case prev: A => // error: the type test for A cannot be checked at runtime +-- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:8:11 -------------------------------------------------- +8 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Error: tests/neg/i4812.scala:18:11 ------------------------------------------------------------- -18 | case prev: A => // error: the type test for A cannot be checked at runtime +-- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:18:11 ------------------------------------------------- +18 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Error: tests/neg/i4812.scala:28:11 ------------------------------------------------------------- -28 | case prev: A => // error: the type test for A cannot be checked at runtime +-- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:28:11 ------------------------------------------------- +28 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Error: tests/neg/i4812.scala:38:11 ------------------------------------------------------------- -38 | case prev: A => // error: the type test for A cannot be checked at runtime +-- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:38:11 ------------------------------------------------- +38 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Error: tests/neg/i4812.scala:50:13 ------------------------------------------------------------- -50 | case prev: A => // error: the type test for A cannot be checked at runtime +-- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:50:13 ------------------------------------------------- +50 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Error: tests/neg/i4812.scala:60:11 ------------------------------------------------------------- -60 | case prev: A => // error: the type test for A cannot be checked at runtime +-- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:60:11 ------------------------------------------------- +60 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Error: tests/neg/i4812.scala:96:11 ------------------------------------------------------------- -96 | case x: B => // error: the type test for B cannot be checked at runtime +-- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:96:11 ------------------------------------------------- +96 | case x: B => // warn: the type test for B cannot be checked at runtime | ^ | the type test for B cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` +No warnings can be incurred under -Werror. diff --git a/tests/neg/i4812.scala b/tests/neg/i4812.scala index 8d518107825c..a2fcd87a134c 100644 --- a/tests/neg/i4812.scala +++ b/tests/neg/i4812.scala @@ -5,7 +5,7 @@ object Test: def test[T](x: T): T = class A(val elem: (T, Boolean)) prev match - case prev: A => // error: the type test for A cannot be checked at runtime + case prev: A => // warn: the type test for A cannot be checked at runtime prev.elem._1 case _ => prev = new A((x, true)) @@ -15,7 +15,7 @@ object Test: abstract class Parent(_elem: T) { def elem: T = _elem } class A extends Parent(x) prev match - case prev: A => // error: the type test for A cannot be checked at runtime + case prev: A => // warn: the type test for A cannot be checked at runtime prev.elem case _ => prev = new A @@ -25,7 +25,7 @@ object Test: class Holder(val elem: T) class A(val holder: Holder) prev match - case prev: A => // error: the type test for A cannot be checked at runtime + case prev: A => // warn: the type test for A cannot be checked at runtime prev.holder.elem case _ => prev = new A(new Holder(x)) @@ -35,7 +35,7 @@ object Test: class Holder(val elem: (Int, (Unit, (T, Boolean)))) class A { var holder: Holder = null } prev match - case prev: A => // error: the type test for A cannot be checked at runtime + case prev: A => // warn: the type test for A cannot be checked at runtime prev.holder.elem._2._2._1 case _ => val a = new A @@ -47,7 +47,7 @@ object Test: def test5(x: U): U = class A(val elem: U) prev match - case prev: A => // error: the type test for A cannot be checked at runtime + case prev: A => // warn: the type test for A cannot be checked at runtime prev.elem case _ => prev = new A(x) @@ -57,7 +57,7 @@ object Test: class A { var b: B = null } class B { var a: A = null; var elem: T = _ } prev match - case prev: A => // error: the type test for A cannot be checked at runtime + case prev: A => // warn: the type test for A cannot be checked at runtime prev.b.elem case _ => val a = new A @@ -93,7 +93,7 @@ object Test: val methodCallId = System.nanoTime() class B(val id: Long) extends A prevA match - case x: B => // error: the type test for B cannot be checked at runtime + case x: B => // warn: the type test for B cannot be checked at runtime x.ensuring(x.id == methodCallId, s"Method call id $methodCallId != ${x.id}") case _ => val x = new B(methodCallId) @@ -117,3 +117,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 diff --git a/tests/neg/i4936b.scala b/tests/neg/i4936b.scala index 58c240e92309..80d9de8aeb7d 100644 --- a/tests/neg/i4936b.scala +++ b/tests/neg/i4936b.scala @@ -1,3 +1,5 @@ //> using options -Xfatal-warnings -final object Foo // error +final object Foo // warn + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i4986b.check b/tests/neg/i4986b.check index db30dcba8003..60a5163ba756 100644 --- a/tests/neg/i4986b.check +++ b/tests/neg/i4986b.check @@ -1,40 +1,41 @@ --- [E158] Reference Error: tests/neg/i4986b.scala:5:65 ----------------------------------------------------------------- -5 |@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.") // error // error +-- [E158] Reference Warning: tests/neg/i4986b.scala:5:65 --------------------------------------------------------------- +5 |@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.") // warn // warn | ^ | Invalid reference to a type variable `Too` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `Meh`. --- [E158] Reference Error: tests/neg/i4986b.scala:5:94 ----------------------------------------------------------------- -5 |@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.") // error // error +-- [E158] Reference Warning: tests/neg/i4986b.scala:5:94 --------------------------------------------------------------- +5 |@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.") // warn // warn | ^ | Invalid reference to a type variable `Elem` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `Meh`. --- [E158] Reference Error: tests/neg/i4986b.scala:8:71 ----------------------------------------------------------------- -8 |@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.") // error +-- [E158] Reference Warning: tests/neg/i4986b.scala:8:71 --------------------------------------------------------------- +8 |@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.") // warn | ^ | Invalid reference to a type variable `Elem` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `Meh2`. --- [E158] Reference Error: tests/neg/i4986b.scala:11:46 ---------------------------------------------------------------- -11 |class C[T](implicit @implicitNotFound("No C[${t}] available") t: T) // error +-- [E158] Reference Warning: tests/neg/i4986b.scala:11:46 -------------------------------------------------------------- +11 |class C[T](implicit @implicitNotFound("No C[${t}] available") t: T) // warn | ^ | Invalid reference to a type variable `t` found in the annotation argument. | The variable does not occur as a parameter in the scope of the constructor of `C`. --- [E158] Reference Error: tests/neg/i4986b.scala:14:54 ---------------------------------------------------------------- -14 | def m[Aaa](implicit @implicitNotFound("I see no C[${Uuh}]") theC: C[Aaa]) = ??? // error +-- [E158] Reference Warning: tests/neg/i4986b.scala:14:54 -------------------------------------------------------------- +14 | def m[Aaa](implicit @implicitNotFound("I see no C[${Uuh}]") theC: C[Aaa]) = ??? // warn | ^ | Invalid reference to a type variable `Uuh` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `m`. --- [E158] Reference Error: tests/neg/i4986b.scala:20:73 ---------------------------------------------------------------- -20 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // error // error // error +-- [E158] Reference Warning: tests/neg/i4986b.scala:20:73 -------------------------------------------------------------- +20 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // warn // warn // warn | ^ | Invalid reference to a type variable `XX` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `m`. --- [E158] Reference Error: tests/neg/i4986b.scala:20:79 ---------------------------------------------------------------- -20 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // error // error // error +-- [E158] Reference Warning: tests/neg/i4986b.scala:20:79 -------------------------------------------------------------- +20 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // warn // warn // warn | ^ | Invalid reference to a type variable `ZZ` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `m`. --- [E158] Reference Error: tests/neg/i4986b.scala:20:86 ---------------------------------------------------------------- -20 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // error // error // error +-- [E158] Reference Warning: tests/neg/i4986b.scala:20:86 -------------------------------------------------------------- +20 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // warn // warn // warn | ^ | Invalid reference to a type variable `Nix` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `m`. +No warnings can be incurred under -Werror. diff --git a/tests/neg/i4986b.scala b/tests/neg/i4986b.scala index c726e40fd4d8..9df1eea64e28 100644 --- a/tests/neg/i4986b.scala +++ b/tests/neg/i4986b.scala @@ -2,21 +2,22 @@ import scala.annotation.implicitNotFound -@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.") // error // error +@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.") // warn // warn trait Meh[-From, +To] -@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.") // error +@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.") // warn trait Meh2[-From, +To] -class C[T](implicit @implicitNotFound("No C[${t}] available") t: T) // error +class C[T](implicit @implicitNotFound("No C[${t}] available") t: T) // warn trait T { - def m[Aaa](implicit @implicitNotFound("I see no C[${Uuh}]") theC: C[Aaa]) = ??? // error + def m[Aaa](implicit @implicitNotFound("I see no C[${Uuh}]") theC: C[Aaa]) = ??? // warn def n[Aaa](implicit @implicitNotFound("I see no C[${Aaa}]") theC: C[Aaa]) = ??? } trait U[X, Y[_], Z[_, ZZ]] { class I[R] { - def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // error // error // error + def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // warn // warn // warn } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i4986d.scala b/tests/neg/i4986d.scala index 909221bea5f0..73c92822a291 100644 --- a/tests/neg/i4986d.scala +++ b/tests/neg/i4986d.scala @@ -3,10 +3,10 @@ trait Foo[A] type Fooable[A] = { - def foo(implicit @annotation.implicitNotFound("There's no Foo[${A}]") ev: Foo[A]): Any // error + def foo(implicit @annotation.implicitNotFound("There's no Foo[${A}]") ev: Foo[A]): Any // warn type InnerFooable = { - def foo(implicit @annotation.implicitNotFound("There's no Foo[${A}]") ev: Foo[A]): Any // error + def foo(implicit @annotation.implicitNotFound("There's no Foo[${A}]") ev: Foo[A]): Any // warn } } @@ -22,3 +22,4 @@ trait Bar[A] type Barable[A] = { def bar(implicit ev: Bar[A]): Any // ok } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i5013.scala b/tests/neg/i5013.scala index adf09e2cf3be..1950770e8204 100644 --- a/tests/neg/i5013.scala +++ b/tests/neg/i5013.scala @@ -2,10 +2,11 @@ class Foo { - def foo1: Unit = 2 // error: A pure expression does nothing in statement position + def foo1: Unit = 2 // warn: A pure expression does nothing in statement position def foo2: Unit = { - 3 // error: A pure expression does nothing in statement position - 4 // error: A pure expression does nothing in statement position + 3 // warn: A pure expression does nothing in statement position + 4 // warn: A pure expression does nothing in statement position } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i5013b.scala b/tests/neg/i5013b.scala index 7ccaf47c12f3..6321538ffef2 100644 --- a/tests/neg/i5013b.scala +++ b/tests/neg/i5013b.scala @@ -11,8 +11,10 @@ class Foo { val c: Unit = () - def foo1: Unit = a // error: A pure expression does nothing in statement position + def foo1: Unit = a // warn: A pure expression does nothing in statement position def foo2: Unit = b def foo3: Unit = c // Not addapted to { c; () } and hence c is not a statement } + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i5077.scala b/tests/neg/i5077.scala index 64de24bfd669..7ea64acf5fb1 100644 --- a/tests/neg/i5077.scala +++ b/tests/neg/i5077.scala @@ -12,7 +12,7 @@ def Test = { // Case 1: error c_string match { - case C(IsInt, _) => println(s"An Int") // error + case C(IsInt, _) => println(s"An Int") // warn case C(IsString, s) => println(s"A String with length ${s.length}") case _ => println("No match") } @@ -30,4 +30,5 @@ def Test = { case C(IsString, s) => println(s"A String with length ${s.length}") case _ => println("No match") } -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i6190b.check b/tests/neg/i6190b.check index 5d4dbd7c24cb..56f23d92f671 100644 --- a/tests/neg/i6190b.check +++ b/tests/neg/i6190b.check @@ -1,4 +1,5 @@ --- Error: tests/neg/i6190b.scala:5:29 ---------------------------------------------------------------------------------- -5 |def foo = List("1", "2").map(Rule) // error +-- Warning: tests/neg/i6190b.scala:5:29 -------------------------------------------------------------------------------- +5 |def foo = List("1", "2").map(Rule) // warn | ^^^^ | The method `apply` is inserted. The auto insertion will be deprecated, please write `Rule.apply` explicitly. +No warnings can be incurred under -Werror. diff --git a/tests/neg/i6190b.scala b/tests/neg/i6190b.scala index 42270c1a984c..2f81d0a5a759 100644 --- a/tests/neg/i6190b.scala +++ b/tests/neg/i6190b.scala @@ -2,4 +2,6 @@ case class Rule(name: String) -def foo = List("1", "2").map(Rule) // error +def foo = List("1", "2").map(Rule) // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i7314.scala b/tests/neg/i7314.scala index b865f2ad881b..541e18c25761 100644 --- a/tests/neg/i7314.scala +++ b/tests/neg/i7314.scala @@ -5,7 +5,9 @@ val imm1 = IArray(1,2,3) // supposedly immutable println(imm1(0)) // 1 imm1 match { - case a: Array[Int] => // error: should not be scrutinized + case a: Array[Int] => // warn: should not be scrutinized a(0) = 0 } println(imm1(0)) // 0 + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i7821.scala b/tests/neg/i7821.scala index 5275c06e487f..6604af7604c1 100644 --- a/tests/neg/i7821.scala +++ b/tests/neg/i7821.scala @@ -16,7 +16,7 @@ object MyXObject { def anX: MyX = XObject.anX given ops: Object with { - extension (x: MyX) def + (y: MyX): MyX = x + y // error: warring: Infinite recursive call + extension (x: MyX) def + (y: MyX): MyX = x + y // warn: warring: Infinite recursive call } } @@ -24,3 +24,4 @@ object Main extends App { println(XObject.anX + XObject.anX) // prints 10 println(MyXObject.anX + MyXObject.anX) // infinite loop } +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i7821b.scala b/tests/neg/i7821b.scala index f82a38d259e1..93598b968adf 100644 --- a/tests/neg/i7821b.scala +++ b/tests/neg/i7821b.scala @@ -2,12 +2,13 @@ object Test { - { def f(x: Int, y: Int): Int = f(x, y) } // error - { def f(x: Int, y: Int): Int = { f(x, y) } } // error - { def f(x: Int, y: Int): Int = f(y, x) } // error - { def f(x: Int, y: Int): Int = f(x, x) } // error - { def f(x: Int, y: Int): Int = f(1, 1) } // error - { def f(x: Int, y: Int): Int = { val a = 3; f(a, 1) } } // error - { def f(x: Int): Int = f(1) } // error + { def f(x: Int, y: Int): Int = f(x, y) } // warn + { def f(x: Int, y: Int): Int = { f(x, y) } } // warn + { def f(x: Int, y: Int): Int = f(y, x) } // warn + { def f(x: Int, y: Int): Int = f(x, x) } // warn + { def f(x: Int, y: Int): Int = f(1, 1) } // warn + { def f(x: Int, y: Int): Int = { val a = 3; f(a, 1) } } // warn + { def f(x: Int): Int = f(1) } // warn } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i8427.scala b/tests/neg/i8427.scala index 3db449bed41c..7c22184aeb03 100644 --- a/tests/neg/i8427.scala +++ b/tests/neg/i8427.scala @@ -1,9 +1,10 @@ //> using options -Xfatal-warnings -@SerialVersionUID(1L) // error +@SerialVersionUID(1L) // warn trait T object Test { var t: T = compiletime.uninitialized def main(args: Array[String]) = println("hi") } +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i8681.scala b/tests/neg/i8681.scala index 4d91509eb0d3..f7e7066fd2e0 100644 --- a/tests/neg/i8681.scala +++ b/tests/neg/i8681.scala @@ -13,4 +13,5 @@ val b = (A(1): A | B) match { case A(_) => "OK" case B(_) => "OK" case C(_) => "NOT OK" // error -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i8711.check b/tests/neg/i8711.check index 5dbeeb22460c..10764e936b5a 100644 --- a/tests/neg/i8711.check +++ b/tests/neg/i8711.check @@ -1,12 +1,21 @@ --- [E030] Match case Unreachable Error: tests/neg/i8711.scala:9:9 ------------------------------------------------------ +-- [E030] Match case Unreachable Warning: tests/neg/i8711.scala:9:9 ---------------------------------------------------- 9 | case x: B => x // error: this case is unreachable since class A is not a subclass of class B | ^^^^ | Unreachable case --- [E030] Match case Unreachable Error: tests/neg/i8711.scala:14:9 ----------------------------------------------------- +-- [E030] Match case Unreachable Warning: tests/neg/i8711.scala:14:9 --------------------------------------------------- 14 | case x: C => x // error | ^^^^ | Unreachable case --- [E030] Match case Unreachable Error: tests/neg/i8711.scala:19:9 ----------------------------------------------------- -19 | case x: (B | C) => x // error +-- [E030] Match case Unreachable Warning: tests/neg/i8711.scala:19:9 --------------------------------------------------- +19 | case x: (B | C) => x // warn | ^^^^^^^^^^ | Unreachable case +-- Error: tests/neg/i8711.scala:9:9 ------------------------------------------------------------------------------------ +9 | case x: B => x // error: this case is unreachable since class A is not a subclass of class B + | ^ + | this case is unreachable since type A and class B are unrelated +-- Error: tests/neg/i8711.scala:14:9 ----------------------------------------------------------------------------------- +14 | case x: C => x // error + | ^ + | this case is unreachable since type A | B and class C are unrelated +No warnings can be incurred under -Werror. diff --git a/tests/neg/i8711.scala b/tests/neg/i8711.scala index 2647e20fe03b..0ae32393a327 100644 --- a/tests/neg/i8711.scala +++ b/tests/neg/i8711.scala @@ -16,7 +16,9 @@ object Test { } def baz(x: A) = x match { - case x: (B | C) => x // error + case x: (B | C) => x // warn case _ => } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i8781b.scala b/tests/neg/i8781b.scala index 7c9b074e1be7..01cd7ef69096 100644 --- a/tests/neg/i8781b.scala +++ b/tests/neg/i8781b.scala @@ -4,4 +4,6 @@ object Test: println((3: Boolean | Int).isInstanceOf[Boolean]) - println(3.isInstanceOf[Boolean]) // error + println(3.isInstanceOf[Boolean]) // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i8922b.scala b/tests/neg/i8922b.scala index 9e615a8d5b58..c199f5be5bd4 100644 --- a/tests/neg/i8922b.scala +++ b/tests/neg/i8922b.scala @@ -33,7 +33,7 @@ object Interpreter { case Binary(left, op, right) => val l = eval(left) val r = eval(right) - (l, r, op.tokenType) match { // error + (l, r, op.tokenType) match { // warn case (l: DoubleV, r: DoubleV, PLUS) => ??? case (l: IntV, r: IntV, PLUS) => ??? case (l: DoubleV, r: IntV, PLUS) => ??? @@ -75,4 +75,6 @@ object Interpreter { } } -} \ No newline at end of file +} + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i9166.scala b/tests/neg/i9166.scala index b9644bf56f71..bfb30937fb21 100644 --- a/tests/neg/i9166.scala +++ b/tests/neg/i9166.scala @@ -1,7 +1,9 @@ //> using options -Xfatal-warnings -Wimplausible-patterns object UnitTest extends App { def foo(m: Unit) = m match { - case runtime.BoxedUnit.UNIT => println("ok") // error + case runtime.BoxedUnit.UNIT => println("ok") // warn } foo(()) } + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i9241.scala b/tests/neg/i9241.scala index e7c959fc9ee2..a169ce709b5f 100644 --- a/tests/neg/i9241.scala +++ b/tests/neg/i9241.scala @@ -1,10 +1,10 @@ //> using options -Xfatal-warnings class Foo { - def unary_~() : Foo = this // error - def unary_-(using Int)(): Foo = this // error - def unary_+()(implicit i: Int): Foo = this // error - def unary_![T](): Foo = this // error + def unary_~() : Foo = this // warn + def unary_-(using Int)(): Foo = this // warn + def unary_+()(implicit i: Int): Foo = this // warn + def unary_![T](): Foo = this // warn } class Bar { @@ -17,27 +17,28 @@ class Bar { final class Baz private (val x: Int) extends AnyVal { def unary_- : Baz = ??? def unary_+[T] : Baz = ??? - def unary_!() : Baz = ??? // error + def unary_!() : Baz = ??? // warn def unary_~(using Int) : Baz = ??? } extension (x: Int) def unary_- : Int = ??? def unary_+[T] : Int = ??? - def unary_!() : Int = ??? // error + def unary_!() : Int = ??? // warn def unary_~(using Int) : Int = ??? end extension extension [T](x: Short) def unary_- : Int = ??? def unary_+[U] : Int = ??? - def unary_!() : Int = ??? // error + def unary_!() : Int = ??? // warn def unary_~(using Int) : Int = ??? end extension extension (using Int)(x: Byte) def unary_- : Int = ??? def unary_+[U] : Int = ??? - def unary_!() : Int = ??? // error + def unary_!() : Int = ??? // warn def unary_~(using Int) : Int = ??? end extension +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i9266.check b/tests/neg/i9266.check index bd80a017da02..d3c0ab354c16 100644 --- a/tests/neg/i9266.check +++ b/tests/neg/i9266.check @@ -1,5 +1,6 @@ --- Error: tests/neg/i9266.scala:5:22 ----------------------------------------------------------------------------------- -5 |def test = { implicit x: Int => x + x } // error +-- Migration Warning: tests/neg/i9266.scala:5:22 ----------------------------------------------------------------------- +5 |def test = { implicit x: Int => x + x } // warn | ^ | This syntax is no longer supported; parameter needs to be enclosed in (...) | This construct can be rewritten automatically under -rewrite -source future-migration. +No warnings can be incurred under -Werror. diff --git a/tests/neg/i9266.scala b/tests/neg/i9266.scala index e6f8db7417c7..168f1fa1b551 100644 --- a/tests/neg/i9266.scala +++ b/tests/neg/i9266.scala @@ -2,4 +2,6 @@ import language.`future-migration` -def test = { implicit x: Int => x + x } // error +def test = { implicit x: Int => x + x } // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i9408a.check b/tests/neg/i9408a.check index d9deb9cddaf7..699128cdc5ce 100644 --- a/tests/neg/i9408a.check +++ b/tests/neg/i9408a.check @@ -1,24 +1,25 @@ --- Error: tests/neg/i9408a.scala:18:20 --------------------------------------------------------------------------------- -18 | val length: Int = "qwerty" // error +-- Migration Warning: tests/neg/i9408a.scala:18:20 --------------------------------------------------------------------- +18 | val length: Int = "qwerty" // warn | ^^^^^^^^ |The conversion (Test3.implicitLength : String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Error: tests/neg/i9408a.scala:23:20 --------------------------------------------------------------------------------- -23 | val length: Int = "qwerty" // error +-- Migration Warning: tests/neg/i9408a.scala:23:20 --------------------------------------------------------------------- +23 | val length: Int = "qwerty" // warn | ^^^^^^^^ |The conversion (Test4.implicitLength : => String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Error: tests/neg/i9408a.scala:28:20 --------------------------------------------------------------------------------- -28 | val length: Int = "qwerty" // error +-- Migration Warning: tests/neg/i9408a.scala:28:20 --------------------------------------------------------------------- +28 | val length: Int = "qwerty" // warn | ^^^^^^^^ |The conversion (Test5.implicitLength : [A]: String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Error: tests/neg/i9408a.scala:33:20 --------------------------------------------------------------------------------- -33 | val length: Int = "qwerty" // error +-- Migration Warning: tests/neg/i9408a.scala:33:20 --------------------------------------------------------------------- +33 | val length: Int = "qwerty" // warn | ^^^^^^^^ |The conversion (Test6.implicitLength : Map[String, Int]) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Error: tests/neg/i9408a.scala:37:60 --------------------------------------------------------------------------------- -37 | implicit def a2int[A](a: A)(implicit ev: A => Int): Int = a // error +-- Migration Warning: tests/neg/i9408a.scala:37:60 --------------------------------------------------------------------- +37 | implicit def a2int[A](a: A)(implicit ev: A => Int): Int = a // warn | ^ |The conversion (ev : A => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Error: tests/neg/i9408a.scala:61:2 ---------------------------------------------------------------------------------- -61 | 123.foo // error +-- Migration Warning: tests/neg/i9408a.scala:61:2 ---------------------------------------------------------------------- +61 | 123.foo // warn | ^^^ |The conversion (Test11.a2foo : [A]: A => Test11.Foo) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. +No warnings can be incurred under -Werror. diff --git a/tests/neg/i9408a.scala b/tests/neg/i9408a.scala index 594417ec3215..d3544ec20be5 100644 --- a/tests/neg/i9408a.scala +++ b/tests/neg/i9408a.scala @@ -15,26 +15,26 @@ object Test2 { object Test3 { implicit val implicitLength: String => Int = _.length - val length: Int = "qwerty" // error + val length: Int = "qwerty" // warn } object Test4 { implicit def implicitLength: String => Int = _.length - val length: Int = "qwerty" // error + val length: Int = "qwerty" // warn } object Test5 { implicit def implicitLength[A]: String => Int = _.length - val length: Int = "qwerty" // error + val length: Int = "qwerty" // warn } object Test6 { implicit val implicitLength: Map[String, Int] = Map("qwerty" -> 6) - val length: Int = "qwerty" // error + val length: Int = "qwerty" // warn } object Test7 { - implicit def a2int[A](a: A)(implicit ev: A => Int): Int = a // error + implicit def a2int[A](a: A)(implicit ev: A => Int): Int = a // warn } object Test8 { @@ -58,7 +58,7 @@ object Test11 { def foo = "foo" } implicit def a2foo[A]: A => Foo = _ => new Foo {} - 123.foo // error + 123.foo // warn } object Test12 { @@ -86,3 +86,4 @@ object Test15 { def foo(implicit ev: Seq[Int]): Unit = ??? foo } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i9408b.check b/tests/neg/i9408b.check index 5f8a854a9282..4d86f5a0ef0b 100644 --- a/tests/neg/i9408b.check +++ b/tests/neg/i9408b.check @@ -1,5 +1,6 @@ --- Error: tests/neg/i9408b/Test_2.scala:8:20 --------------------------------------------------------------------------- -8 | val length: Int = "abc" // error +-- Migration Warning: tests/neg/i9408b/Test_2.scala:8:20 --------------------------------------------------------------- +8 | val length: Int = "abc" // warn | ^^^^^ |The conversion (test.conversions.Conv.implicitLength : String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. +No warnings can be incurred under -Werror. diff --git a/tests/neg/i9408b/Test_2.scala b/tests/neg/i9408b/Test_2.scala index 6b3cbbafcb0e..11cad10f1e9f 100644 --- a/tests/neg/i9408b/Test_2.scala +++ b/tests/neg/i9408b/Test_2.scala @@ -5,5 +5,7 @@ import scala.language.implicitConversions object Test { import test.conversions.Conv.* - val length: Int = "abc" // error + val length: Int = "abc" // warn } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i9740.check b/tests/neg/i9740.check index 359603a2863a..1d8280ca1963 100644 --- a/tests/neg/i9740.check +++ b/tests/neg/i9740.check @@ -1,12 +1,13 @@ --- [E186] Type Error: tests/neg/i9740.scala:10:9 ----------------------------------------------------------------------- -10 | case RecoveryCompleted => println("Recovery completed") // error +-- [E186] Type Warning: tests/neg/i9740.scala:10:9 --------------------------------------------------------------------- +10 | case RecoveryCompleted => println("Recovery completed") // warn | ^^^^^^^^^^^^^^^^^ | Implausible pattern: | RecoveryCompleted could match selector of type object TypedRecoveryCompleted | only if there is an `equals` method identifying elements of the two types. --- [E186] Type Error: tests/neg/i9740.scala:15:9 ----------------------------------------------------------------------- -15 | case RecoveryCompleted => // error +-- [E186] Type Warning: tests/neg/i9740.scala:15:9 --------------------------------------------------------------------- +15 | case RecoveryCompleted => // warn | ^^^^^^^^^^^^^^^^^ | Implausible pattern: | RecoveryCompleted could match selector of type TypedRecoveryCompleted | only if there is an `equals` method identifying elements of the two types. +No warnings can be incurred under -Werror. diff --git a/tests/neg/i9740.scala b/tests/neg/i9740.scala index 6222298df48b..8e5f56eaab0d 100644 --- a/tests/neg/i9740.scala +++ b/tests/neg/i9740.scala @@ -7,11 +7,12 @@ object TypedRecoveryCompleted extends TypedRecoveryCompleted class Test { TypedRecoveryCompleted match { - case RecoveryCompleted => println("Recovery completed") // error + case RecoveryCompleted => println("Recovery completed") // warn case TypedRecoveryCompleted => println("Typed recovery completed") } def foo(x: TypedRecoveryCompleted) = x match - case RecoveryCompleted => // error + case RecoveryCompleted => // warn case TypedRecoveryCompleted => } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i9740b.scala b/tests/neg/i9740b.scala index dcd9a1d6a474..3f3f9a85222c 100644 --- a/tests/neg/i9740b.scala +++ b/tests/neg/i9740b.scala @@ -10,11 +10,12 @@ import TypedRecovery.* class Test { TypedRecoveryCompleted match { - case RecoveryCompleted => println("Recovery completed") // error + case RecoveryCompleted => println("Recovery completed") // warn case TypedRecoveryCompleted => println("Typed recovery completed") } def foo(x: TypedRecovery) = x match - case RecoveryCompleted => // error + case RecoveryCompleted => // warn case TypedRecoveryCompleted => } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i9740c.scala b/tests/neg/i9740c.scala index c6a3a1380f1d..b250ac907454 100644 --- a/tests/neg/i9740c.scala +++ b/tests/neg/i9740c.scala @@ -12,6 +12,8 @@ class Foo { def bar[A <: Txn[A]](x: Exp[A]): Unit = x match case IntExp(x) => case StrExp(x) => - case UnitExp => // error + case UnitExp => // warn case Obj(o) => } + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i9740d.scala b/tests/neg/i9740d.scala index 6f3cc3be02e2..ee0df4ea7cf7 100644 --- a/tests/neg/i9740d.scala +++ b/tests/neg/i9740d.scala @@ -9,5 +9,6 @@ class Foo[U <: Int, T <: U] { def bar[A <: T](x: Exp[A]): Unit = x match case IntExp(x) => case StrExp(x) => - case UnitExp => // error + case UnitExp => // warn } +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i9751.scala b/tests/neg/i9751.scala index 618d237e0cd4..1b3fa1a01656 100644 --- a/tests/neg/i9751.scala +++ b/tests/neg/i9751.scala @@ -1,11 +1,12 @@ //> using options -Xfatal-warnings def f(): Unit = { - () // error + () // warn () } inline def g(): Unit = { - () // error + () // warn () } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i9776.scala b/tests/neg/i9776.scala index b05488810416..d0f512454a31 100644 --- a/tests/neg/i9776.scala +++ b/tests/neg/i9776.scala @@ -12,7 +12,7 @@ object Fruit { case object Orange extends Fruit def isCitrus(fruit: Fruit): Boolean = - (fruit: @switch) match { // error Could not emit switch for @switch annotated match + (fruit: @switch) match { // warn Could not emit switch for @switch annotated match case Orange => true case Lemon => true case Lime => true @@ -37,7 +37,7 @@ object TaggedFruit { } def isCitrus(fruit: TaggedFruit): Boolean = - (fruit.tag: @switch) match { // error Could not emit switch for @switch annotated match + (fruit.tag: @switch) match { // warn Could not emit switch for @switch annotated match case Apple.tag => true case 2 => true case 3 => true @@ -59,3 +59,4 @@ object TaggedFruit { case Apple.tag => true } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i9880.scala b/tests/neg/i9880.scala index f99fae25e5dc..963711277faf 100644 --- a/tests/neg/i9880.scala +++ b/tests/neg/i9880.scala @@ -3,7 +3,7 @@ opaque type Bytes = Array[Byte] object Bytes: extension (self: Bytes) - def size: Int = (self: Array[Byte]).size // error + def size: Int = (self: Array[Byte]).size // warn // @@ -20,7 +20,7 @@ object Module2: object Gen: extension [A](self: Gen[A]) def map[B](f: A => B): Gen[B] = - self.map(f) // error + self.map(f) // warn // @@ -30,3 +30,4 @@ extension (sym: Sym) def isSomething: Boolean = false def isFoo: Boolean = sym.isSomething && sym.owner.isFoo // was: Infinite loop in function body def isBar: Boolean = sym.isSomething || sym.owner.isBar // was: Infinite loop in function body +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/impl-conv/A.scala b/tests/neg/impl-conv/A.scala index 31eccf4fa4f7..9c47e67ca789 100644 --- a/tests/neg/impl-conv/A.scala +++ b/tests/neg/impl-conv/A.scala @@ -2,7 +2,7 @@ package implConv object A { - implicit def s2i(x: String): Int = Integer.parseInt(x) // error: feature + implicit def s2i(x: String): Int = Integer.parseInt(x) // warn: feature given i2s: Conversion[Int, String] = _.toString // ok implicit class Foo(x: String) { diff --git a/tests/neg/impl-conv/B.scala b/tests/neg/impl-conv/B.scala index 618868b8bbc0..b475c460f318 100644 --- a/tests/neg/impl-conv/B.scala +++ b/tests/neg/impl-conv/B.scala @@ -8,5 +8,6 @@ object B { "".foo val x: Int = "" // ok - val y: String = 1 // error: feature + val y: String = 1 // warn: feature } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/implicit-conversions-old.scala b/tests/neg/implicit-conversions-old.scala index 0a7b75766bbf..c1267ae79064 100644 --- a/tests/neg/implicit-conversions-old.scala +++ b/tests/neg/implicit-conversions-old.scala @@ -5,15 +5,15 @@ class B object A { - implicit def a2b(x: A): B = ??? // error under -Xfatal-warnings -feature + implicit def a2b(x: A): B = ??? // warn under -Xfatal-warnings -feature - implicit def b2a(x: B): A = ??? // error under -Xfatal-warnings -feature + implicit def b2a(x: B): A = ??? // warn under -Xfatal-warnings -feature } class C object D { - implicit def a2c(x: A): C = ??? // error under -Xfatal-warnings -feature + implicit def a2c(x: A): C = ??? // warn under -Xfatal-warnings -feature } object Test { @@ -22,4 +22,5 @@ object Test { val x1: A = new B val x2: B = new A // ok, since it's an old-style comversion val x3: C = new A // ok, since it's an old-style comversion -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/implicit-conversions.scala b/tests/neg/implicit-conversions.scala index ead8c5ac7646..154fc0689d98 100644 --- a/tests/neg/implicit-conversions.scala +++ b/tests/neg/implicit-conversions.scala @@ -25,7 +25,8 @@ object D { object Test { import D.given - val x1: A = new B // error under -Xfatal-warnings -feature - val x2: B = new A // error under -Xfatal-warnings -feature - val x3: C = new A // error under -Xfatal-warnings -feature -} \ No newline at end of file + val x1: A = new B // warn under -Xfatal-warnings -feature + val x2: B = new A // warn under -Xfatal-warnings -feature + val x3: C = new A // warn under -Xfatal-warnings -feature +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/indentLeft.scala b/tests/neg/indentLeft.scala index c4a260583de2..7e1cf8041bc7 100644 --- a/tests/neg/indentLeft.scala +++ b/tests/neg/indentLeft.scala @@ -1,10 +1,11 @@ //> using options -Xfatal-warnings +// nopos-error: No warnings can be incurred under -Werror. object Test { if (true) { println("hi") - println("!") // error: too far to the left + println("!") // warn: too far to the left } // error: too far to the left \ No newline at end of file diff --git a/tests/neg/indentRight.scala b/tests/neg/indentRight.scala index 8eb9deb23389..6c43651d67e6 100644 --- a/tests/neg/indentRight.scala +++ b/tests/neg/indentRight.scala @@ -1,19 +1,19 @@ //> using options -no-indent -Xfatal-warnings trait A - case class B() extends A // error: Line is indented too far to the right - case object C extends A // error: Line is indented too far to the right + case class B() extends A // warn: Line is indented too far to the right + case object C extends A // warn: Line is indented too far to the right object Test { if (true) println("ho") - println("hu") // error: Line is indented too far to the right + println("hu") // warn: Line is indented too far to the right if (true) { println("ho") } - println("hu") // error: Line is indented too far to the right + println("hu") // warn: Line is indented too far to the right while (true) () @@ -24,8 +24,8 @@ object Test { } trait A - case class B() extends A // error: Line is indented too far to the right - case object C extends A // error: Line is indented too far to the right + case class B() extends A // warn: Line is indented too far to the right + case object C extends A // warn: Line is indented too far to the right if (true) // OK println("hi") @@ -33,4 +33,4 @@ object Test { println("!") // error: expected a toplevel definition } - +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/infix.scala b/tests/neg/infix.scala index aefdd5c40d47..2be1e3091eed 100644 --- a/tests/neg/infix.scala +++ b/tests/neg/infix.scala @@ -23,8 +23,8 @@ def test() = { c.op(2) c.iop(2) - c mop 2 // error: should not be used as infix operator - c meth 2 // error: should not be used as infix operator + c mop 2 // warn: should not be used as infix operator + c meth 2 // warn: should not be used as infix operator c `meth` 2 // OK, sincd `meth` is backquoted c + 3 // OK, since `+` is symbolic 1 to 2 // OK, since `to` is defined by Scala-2 @@ -42,9 +42,9 @@ def test() = { class Map[X, Y] - val x1: Int Map String = ??? // error + val x1: Int Map String = ??? // warn val x2: Int Or String = ??? // OK since Or is declared `infix` - val x3: Int AndC String = ??? // error + val x3: Int AndC String = ??? // warn val x4: Int `AndC` String = ??? // OK val x5: Int And String = ??? // OK val x6: Int && String = ??? @@ -58,7 +58,7 @@ def test() = { val p = Pair(1, 2) val Pair(_, _) = p - val _ Pair _ = p // error + val _ Pair _ = p // warn val _ `Pair` _ = p // OK val (_ PP _) = p: @unchecked // OK @@ -68,3 +68,4 @@ def test() = { } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/inline-givens.scala b/tests/neg/inline-givens.scala index 3e388de2ce8b..d8b9d1f2692c 100644 --- a/tests/neg/inline-givens.scala +++ b/tests/neg/inline-givens.scala @@ -3,14 +3,14 @@ class Item(x: String) inline given a: Conversion[String, Item] = - Item(_) // error + Item(_) // warn inline given b: Conversion[String, Item] = - (x => Item(x)) // error + (x => Item(x)) // warn inline given c: Conversion[String, Item] = - { x => Item(x) } // error + { x => Item(x) } // warn inline given d: Conversion[String, Item] with def apply(x: String) = Item(x) // ok - +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/main-functions-nameclash.scala b/tests/neg/main-functions-nameclash.scala index 1f9352e1592d..e72f3d2eb0a4 100644 --- a/tests/neg/main-functions-nameclash.scala +++ b/tests/neg/main-functions-nameclash.scala @@ -1,5 +1,7 @@ //> using options -Xfatal-warnings object foo { - @main def foo(x: Int) = () // error: class foo and object foo produce classes that overwrite one another + @main def foo(x: Int) = () // warn: class foo and object foo produce classes that overwrite one another } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/manifest-summoning-b.check b/tests/neg/manifest-summoning-b.check index bb63eebb555f..c364ab4f4a9c 100644 --- a/tests/neg/manifest-summoning-b.check +++ b/tests/neg/manifest-summoning-b.check @@ -1,14 +1,15 @@ --- Error: tests/neg/manifest-summoning-b.scala:3:34 -------------------------------------------------------------------- -3 |val foo = manifest[List[? <: Int]] // error +-- Deprecation Warning: tests/neg/manifest-summoning-b.scala:3:34 ------------------------------------------------------ +3 |val foo = manifest[List[? <: Int]] // warn | ^ | Compiler synthesis of Manifest and OptManifest is deprecated, instead | replace with the type `scala.reflect.ClassTag[List[? <: Int]]`. | Alternatively, consider using the new metaprogramming features of Scala 3, | see https://docs.scala-lang.org/scala3/reference/metaprogramming.html --- Error: tests/neg/manifest-summoning-b.scala:4:41 -------------------------------------------------------------------- -4 |val bar = optManifest[Array[? <: String]] // error +-- Deprecation Warning: tests/neg/manifest-summoning-b.scala:4:41 ------------------------------------------------------ +4 |val bar = optManifest[Array[? <: String]] // warn | ^ | Compiler synthesis of Manifest and OptManifest is deprecated, instead | replace with the type `scala.reflect.ClassTag[Array[? <: String]]`. | Alternatively, consider using the new metaprogramming features of Scala 3, | see https://docs.scala-lang.org/scala3/reference/metaprogramming.html +No warnings can be incurred under -Werror. diff --git a/tests/neg/manifest-summoning-b.scala b/tests/neg/manifest-summoning-b.scala index 6d1b8baff007..83e8b69ead00 100644 --- a/tests/neg/manifest-summoning-b.scala +++ b/tests/neg/manifest-summoning-b.scala @@ -1,4 +1,5 @@ //> using options -Xfatal-warnings -deprecation -val foo = manifest[List[? <: Int]] // error -val bar = optManifest[Array[? <: String]] // error +val foo = manifest[List[? <: Int]] // warn +val bar = optManifest[Array[? <: String]] // warn +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/matchable.scala b/tests/neg/matchable.scala index aaf8234f6d1e..6d8b41f87e55 100644 --- a/tests/neg/matchable.scala +++ b/tests/neg/matchable.scala @@ -4,26 +4,26 @@ def foo[T](x: T): Matchable = println(x.getClass()) // ok println(x.isInstanceOf[Int]) // ok x match - case x: Int => // error: should not be scrutinized + case x: Int => // warn: should not be scrutinized println("int") x - case x: String => // error: should not be scrutinized + case x: String => // warn: should not be scrutinized println("string") x List(x) match - case (x: Int) :: Nil => // error: should not be scrutinized + case (x: Int) :: Nil => // warn: should not be scrutinized println("int") x - case List(x: String) => // error: should not be scrutinized + case List(x: String) => // warn: should not be scrutinized println("string") x - case List(y :: Nil) => // error: should not be scrutinized + case List(y :: Nil) => // warn: should not be scrutinized y :: Nil case _ => - x // error: should not be scrutinized + x // warn: should not be scrutinized @main def Test = val x: Matchable = foo(1) val y: Matchable = foo("hello") assert(x != y) - +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/missing-targetName.scala b/tests/neg/missing-targetName.scala index b5403ac7cb19..8c799c4a19dd 100644 --- a/tests/neg/missing-targetName.scala +++ b/tests/neg/missing-targetName.scala @@ -5,7 +5,8 @@ import scala.annotation.targetName class & { // error @targetName("op") def *(x: Int): Int = ??? // OK - def / (x: Int): Int // error - val frozen_& : Int = ??? // error - object some_??? // error + def / (x: Int): Int // warn + val frozen_& : Int = ??? // warn + object some_??? // warn } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/newline-braces.scala b/tests/neg/newline-braces.scala index afe7731f3095..2aea81c229b2 100644 --- a/tests/neg/newline-braces.scala +++ b/tests/neg/newline-braces.scala @@ -2,7 +2,9 @@ def f: List[Int] = { List(1, 2, 3).map // no newline inserted here in Scala-2 compat mode - { x => // error (migration) + { x => // warn (migration) x + 1 } } + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/nonunit-statement.scala b/tests/neg/nonunit-statement.scala index 73c190619187..b96d6b5cfa59 100644 --- a/tests/neg/nonunit-statement.scala +++ b/tests/neg/nonunit-statement.scala @@ -9,38 +9,38 @@ class C { def c = { def improved = Future(42) def stale = Future(27) - improved // error + improved // warn stale } } class D { def d = { class E - new E().toString // error + new E().toString // warn new E().toString * 2 } } class F { import ExecutionContext.Implicits._ - Future(42) // error + Future(42) // warn } // unused template expression uses synthetic method of class case class K(s: String) { - copy() // error + copy() // warn } // mutations returning this are ok class Mutate { val b = ListBuffer.empty[Int] b += 42 // nowarn, returns this.type val xs = List(42) - 27 +: xs // error + 27 +: xs // warn def f(x: Int): this.type = this def g(): Unit = f(42) // nowarn } // some uninteresting expressions may warn for other reasons class WhoCares { - null // error for purity + null // warn for purity ??? // nowarn for impurity } // explicit Unit ascription to opt out of warning, even for funky applies @@ -54,11 +54,11 @@ class Absolution { class Boxed[A](a: A) { def isEmpty = false def foreach[U](f: A => U): Unit = - if (!isEmpty) f(a) // error (if) + if (!isEmpty) f(a) // warn (if) def forall(f: A => Boolean): Unit = if (!isEmpty) { println(".") - f(a) // error (if) + f(a) // warn (if) } def take(p: A => Boolean): Option[A] = { while (isEmpty || !p(a)) () @@ -69,20 +69,20 @@ class Unibranch[A, B] { def runWith[U](action: B => U): A => Boolean = { x => val z = null.asInstanceOf[B] val fellback = false - if (!fellback) action(z) // error (if) + if (!fellback) action(z) // warn (if) !fellback } def f(i: Int): Int = { def g = 17 if (i < 42) { - g // error block statement + g // warn block statement println("uh oh") - g // error (if) + g // warn (if) } while (i < 42) { - g // error + g // warn println("uh oh") - g // error + g // warn } 42 } @@ -92,7 +92,7 @@ class Dibranch { def j: Int = ??? def f(b: Boolean): Int = { // if-expr might have an uninteresting LUB - if (b) { // error, at least one branch looks interesting + if (b) { // warn, at least one branch looks interesting println("true") i } @@ -112,7 +112,7 @@ class Next[A] { class Setting[A] { def set = LinkedHashSet.empty[A] def f(a: A): Unit = { - set += a // error because cannot know whether the `set` was supposed to be consumed or assigned + set += a // warn because cannot know whether the `set` was supposed to be consumed or assigned println(set) } } @@ -122,27 +122,27 @@ class Strung { def iterator = Iterator.empty[String] def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder = { val jsb = b.underlying - if (start.length != 0) jsb.append(start) // error (value-discard) + if (start.length != 0) jsb.append(start) // warn (value-discard) val it = iterator if (it.hasNext) { jsb.append(it.next()) while (it.hasNext) { jsb.append(sep) // nowarn (java) - jsb.append(it.next()) // error (value-discard) + jsb.append(it.next()) // warn (value-discard) } } - if (end.length != 0) jsb.append(end) // error (value-discard) + if (end.length != 0) jsb.append(end) // warn (value-discard) b } def f(b: java.lang.StringBuilder, it: Iterator[String]): String = { while (it.hasNext) { b.append("\n") // nowarn (java) - b.append(it.next()) // error (value-discard) + b.append(it.next()) // warn (value-discard) } b.toString } def g(b: java.lang.StringBuilder, it: Iterator[String]): String = { - while (it.hasNext) it.next() // error + while (it.hasNext) it.next() // warn b.toString } } @@ -196,3 +196,4 @@ class Depends { () } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/old-syntax.scala b/tests/neg/old-syntax.scala index 124781d13db2..4f031c96c4c4 100644 --- a/tests/neg/old-syntax.scala +++ b/tests/neg/old-syntax.scala @@ -1,5 +1,6 @@ //> using options -Xfatal-warnings -deprecation -val f = (x: Int) ⇒ x + 1 // error +val f = (x: Int) ⇒ x + 1 // warn -val list = for (n ← List(42)) yield n + 1 // error +val list = for (n ← List(42)) yield n + 1 // warn +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/opaque-match.scala b/tests/neg/opaque-match.scala index 59d0836fb2a3..88c8104506ae 100644 --- a/tests/neg/opaque-match.scala +++ b/tests/neg/opaque-match.scala @@ -12,17 +12,14 @@ def Test[T] = O.x match case _: C => ??? // ok C() match - case _: O.T => ??? // error + case _: O.T => ??? // warn C() match - case _: T => ??? // error + case _: T => ??? // warn (??? : Any) match - case _: List[O.T] => ??? // error + case _: List[O.T] => ??? // warn (??? : Any) match case _: List[O.T @unchecked] => ??? // OK (??? : Any) match - case _: List[T] => ??? // error - - - - + case _: List[T] => ??? // warn +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/ovlazy.scala b/tests/neg/ovlazy.scala index 69078fbd2745..1331589c5d3b 100644 --- a/tests/neg/ovlazy.scala +++ b/tests/neg/ovlazy.scala @@ -4,5 +4,7 @@ class A { val x: Int = 1 } class B extends A { - override lazy val x: Int = 2 // error + override lazy val x: Int = 2 // warn } + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/pureStatement.scala b/tests/neg/pureStatement.scala index 4d2ea1d49b08..72d39ce2ecf6 100644 --- a/tests/neg/pureStatement.scala +++ b/tests/neg/pureStatement.scala @@ -3,16 +3,16 @@ class IOCapability object Test { - "" // error: pure expression does nothing in statement position + "" // warn: pure expression does nothing in statement position locally { - "" // error: pure expression does nothing in statement position + "" // warn: pure expression does nothing in statement position println("") - 42 // error: pure expression does nothing in statement position + 42 // warn: pure expression does nothing in statement position - ((x: Int) => println("hi")) // error: pure expression does nothing in statement position + ((x: Int) => println("hi")) // warn: pure expression does nothing in statement position () } @@ -24,7 +24,7 @@ object Test { implicit val cap: IOCapability = new IOCapability - 2 // error: pure expression does nothing in statement position + 2 // warn: pure expression does nothing in statement position doSideEffects(1) // error: pure expression does nothing in statement position @@ -32,3 +32,4 @@ object Test { broken.foo // no extra error, and no pure expression warning broken.foo() // same } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/quote-simple-hole.scala b/tests/neg/quote-simple-hole.scala index 64e2bcad4862..88af780aa5cd 100644 --- a/tests/neg/quote-simple-hole.scala +++ b/tests/neg/quote-simple-hole.scala @@ -4,14 +4,15 @@ import scala.quoted.Quotes def test(using Quotes) = { val x = '{0} - val y = '{ // error: Canceled splice directly inside a quote. '{ ${ XYZ } } is equivalent to XYZ. + val y = '{ // warn: Canceled splice directly inside a quote. '{ ${ XYZ } } is equivalent to XYZ. $x } val z = '{ - val a = ${ // error: Canceled quote directly inside a splice. ${ '{ XYZ } } is equivalent to XYZ. + val a = ${ // warn: Canceled quote directly inside a splice. ${ '{ XYZ } } is equivalent to XYZ. '{ $y } } } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/refinements-this.scala b/tests/neg/refinements-this.scala index f8d41bd85360..111ce84ffdc8 100644 --- a/tests/neg/refinements-this.scala +++ b/tests/neg/refinements-this.scala @@ -2,4 +2,6 @@ class Outer: type X = { type O = Outer.this.type } // ok - type Y = { type O = this.type } // error + type Y = { type O = this.type } // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/refutable-pattern-binding-messages.check b/tests/neg/refutable-pattern-binding-messages.check index b1b8866e174f..50564f5675d2 100644 --- a/tests/neg/refutable-pattern-binding-messages.check +++ b/tests/neg/refutable-pattern-binding-messages.check @@ -1,48 +1,49 @@ --- Error: tests/neg/refutable-pattern-binding-messages.scala:5:14 ------------------------------------------------------ -5 | val Positive(p) = 5 // error: refutable extractor +-- Warning: tests/neg/refutable-pattern-binding-messages.scala:5:14 ---------------------------------------------------- +5 | val Positive(p) = 5 // warn: 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 +-- Warning: tests/neg/refutable-pattern-binding-messages.scala:6:14 ---------------------------------------------------- +6 | for Positive(i) <- List(1, 2, 3) do () // warn: refutable extractor | ^^^^^^^^^^^ | pattern binding uses refutable extractor `Test.Positive` | | 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 +-- Warning: tests/neg/refutable-pattern-binding-messages.scala:10:20 --------------------------------------------------- +10 | val i :: is = List(1, 2, 3) // warn: 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 +-- Warning: tests/neg/refutable-pattern-binding-messages.scala:11:11 --------------------------------------------------- +11 | for ((x: String) <- xs) do () // warn: pattern type more specialized | ^^^^^^ | pattern's type String is more specialized than the right hand side expression's type AnyRef | | 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:15:13 ----------------------------------------------------- -15 | for none @ None <- ys do () // error: pattern type does not match +-- Warning: tests/neg/refutable-pattern-binding-messages.scala:15:13 --------------------------------------------------- +15 | for none @ None <- ys do () // warn: pattern type does not match | ^^^^ | pattern's type None.type does not match the right hand side expression's type (x$1 : Option[?]) | | 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:16:10 ----------------------------------------------------- -16 | val 1 = 2 // error: pattern type does not match +-- Warning: tests/neg/refutable-pattern-binding-messages.scala:16:10 --------------------------------------------------- +16 | val 1 = 2 // warn: pattern type does not match | ^ | pattern's type (1 : Int) does not match the right hand side expression's type (2 : 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. +No warnings can be incurred under -Werror. diff --git a/tests/neg/refutable-pattern-binding-messages.scala b/tests/neg/refutable-pattern-binding-messages.scala index c6ae043652c2..bdbacdfa9c03 100644 --- a/tests/neg/refutable-pattern-binding-messages.scala +++ b/tests/neg/refutable-pattern-binding-messages.scala @@ -2,16 +2,17 @@ object Test { // refutable extractor object Positive { def unapply(i: Int): Option[Int] = Some(i).filter(_ > 0) } - val Positive(p) = 5 // error: refutable extractor - for Positive(i) <- List(1, 2, 3) do () // error: refutable extractor + val Positive(p) = 5 // warn: refutable extractor + for Positive(i) <- List(1, 2, 3) do () // warn: refutable extractor // more specialized val xs: List[AnyRef] = ??? - val i :: is = List(1, 2, 3) // error: pattern type more specialized - for ((x: String) <- xs) do () // error: pattern type more specialized + val i :: is = List(1, 2, 3) // warn: pattern type more specialized + for ((x: String) <- xs) do () // warn: pattern type more specialized // does not match val ys: List[Option[?]] = ??? - for none @ None <- ys do () // error: pattern type does not match - val 1 = 2 // error: pattern type does not match + 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 diff --git a/tests/neg/rewrite-messages.check b/tests/neg/rewrite-messages.check index 3ee081edbed2..b1aa67845a3f 100644 --- a/tests/neg/rewrite-messages.check +++ b/tests/neg/rewrite-messages.check @@ -1,11 +1,12 @@ --- Error: tests/neg/rewrite-messages.scala:3:18 ------------------------------------------------------------------------ -3 |import scala.util._ // error +-- Migration Warning: tests/neg/rewrite-messages.scala:3:18 ------------------------------------------------------------ +3 |import scala.util._ // warn | ^ | `_` is no longer supported for a wildcard import; use `*` instead | This construct can be rewritten automatically under -rewrite -source future-migration. --- Error: tests/neg/rewrite-messages.scala:7:4 ------------------------------------------------------------------------- -7 | 2 foo 4 // error +-- Deprecation Warning: tests/neg/rewrite-messages.scala:7:4 ----------------------------------------------------------- +7 | 2 foo 4 // warn | ^^^ | Alphanumeric method foo is not declared infix; it should not be used as infix operator. | Instead, use method syntax .foo(...) or backticked identifier `foo`. | The latter can be rewritten automatically under -rewrite -deprecation. +No warnings can be incurred under -Werror. diff --git a/tests/neg/rewrite-messages.scala b/tests/neg/rewrite-messages.scala index 7509682c4baa..25eeea997b8f 100644 --- a/tests/neg/rewrite-messages.scala +++ b/tests/neg/rewrite-messages.scala @@ -1,8 +1,9 @@ //> using options -source:future-migration -deprecation -Werror -import scala.util._ // error +import scala.util._ // warn object Test { extension (x: Int) def foo(y: Int) = x + y - 2 foo 4 // error + 2 foo 4 // warn } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/strict-pattern-bindings-3.2.scala b/tests/neg/strict-pattern-bindings-3.2.scala index d7db6cd165e4..c678e2ebe93a 100644 --- a/tests/neg/strict-pattern-bindings-3.2.scala +++ b/tests/neg/strict-pattern-bindings-3.2.scala @@ -6,32 +6,33 @@ object Test: // from filtering-fors.scala val xs: List[AnyRef] = ??? - for ((x: String) <- xs) do () // error - for (y@ (x: String) <- xs) do () // error - for ((x, y) <- xs) do () // error + for ((x: String) <- xs) do () // warn + for (y@ (x: String) <- xs) do () // warn + for ((x, y) <- xs) do () // warn - for ((x: String) <- xs if x.isEmpty) do () // error - for ((x: String) <- xs; y = x) do () // error - for ((x: String) <- xs; (y, z) <- xs) do () // error // error - for (case (x: String) <- xs; (y, z) <- xs) do () // error - for ((x: String) <- xs; case (y, z) <- xs) do () // error + for ((x: String) <- xs if x.isEmpty) do () // warn + for ((x: String) <- xs; y = x) do () // warn + for ((x: String) <- xs; (y, z) <- xs) do () // warn // warn + for (case (x: String) <- xs; (y, z) <- xs) do () // warn + for ((x: String) <- xs; case (y, z) <- xs) do () // warn val pairs: List[AnyRef] = List((1, 2), "hello", (3, 4)) - for ((x, y) <- pairs) yield (y, x) // error + for ((x, y) <- pairs) yield (y, x) // warn // from unchecked-patterns.scala - val y :: ys = List(1, 2, 3) // error - val (1, c) = (1, 2) // error - val 1 *: cs = 1 *: Tuple() // error + val y :: ys = List(1, 2, 3) // warn + val (1, c) = (1, 2) // warn + val 1 *: cs = 1 *: Tuple() // warn - val (_: Int | _: AnyRef) = ??? : AnyRef // error + val (_: Int | _: AnyRef) = ??? : AnyRef // warn - val 1 = 2 // error + val 1 = 2 // warn object Positive { def unapply(i: Int): Option[Int] = Some(i).filter(_ > 0) } object Always1 { def unapply(i: Int): Some[Int] = Some(i) } object Pair { def unapply(t: (Int, Int)): t.type = t } object Triple { def unapply(t: (Int, Int, Int)): (Int, Int, Int) = t } - val Positive(p) = 5 // error - val Some(s1) = Option(1) // error + val Positive(p) = 5 // warn + val Some(s1) = Option(1) // warn +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/structural-2.scala b/tests/neg/structural-2.scala index 3613d6073e34..85fac55c08a5 100644 --- a/tests/neg/structural-2.scala +++ b/tests/neg/structural-2.scala @@ -69,7 +69,8 @@ object Test { package p6 { class Refinements { - val y: { val x: T; type T } // error: deprecated warning: illegal forward reference in refinement; now illegal + val y: { val x: T; type T } // warn: deprecated warning: illegal forward reference in refinement; now illegal } } +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/supertraits-b.scala b/tests/neg/supertraits-b.scala index 78854537974e..b56059b4abbb 100644 --- a/tests/neg/supertraits-b.scala +++ b/tests/neg/supertraits-b.scala @@ -16,20 +16,21 @@ object Test: choose0(a, b) match case _: TA => ??? - case _: TB => ??? // error: unreachable + case _: TB => ??? // warn: unreachable choose1(a, b) match case _: TA => ??? - case _: TB => ??? // error: unreachable + case _: TB => ??? // warn: unreachable choose2(a, b) match case _: TB => ??? - case _: TA => ??? // error: unreachable + case _: TA => ??? // warn: unreachable choose3(a, b) match case _: Product => ??? - case _: TA => ??? // error: unreachable + case _: TA => ??? // warn: unreachable choose4(a, b) match case _: (TA & TB) => ??? - case _: Product => ??? // error: unreachable \ No newline at end of file + case _: Product => ??? // warn: unreachable +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/switches.scala b/tests/neg/switches.scala index d405f8185706..f662a1f694ca 100644 --- a/tests/neg/switches.scala +++ b/tests/neg/switches.scala @@ -38,7 +38,7 @@ object Main { // multiple annotations are processed correctly // thinks a val in an object is constant... so naive - def fail1(c: Char) = (c: @switch @unchecked) match { // error: Could not emit switch for @switch annotated match + def fail1(c: Char) = (c: @switch @unchecked) match { // warn: Could not emit switch for @switch annotated match case 'A' => true case 'B' => true case Other.C1 => true @@ -46,7 +46,7 @@ object Main { } // more naivete - def fail2(c: Char) = (c: @unchecked @switch) match { // error: Could not emit switch for @switch annotated match + def fail2(c: Char) = (c: @unchecked @switch) match { // warn: Could not emit switch for @switch annotated match case 'A' => true case 'B' => true case Other.C3 => true @@ -69,12 +69,12 @@ object Main { case _ => -1 } - def fail3(x: Any) = (x: @switch) match { // error: Could not emit switch for @switch annotated match + def fail3(x: Any) = (x: @switch) match { // warn: Could not emit switch for @switch annotated match case 1 | 2 | 3 => true case _ => false } - def fail4(x: AnyVal) = (x: @switch) match { // error: Could not emit switch for @switch annotated match + def fail4(x: AnyVal) = (x: @switch) match { // warn: Could not emit switch for @switch annotated match case 1 | 2 | 3 => true case _ => false } @@ -82,7 +82,7 @@ object Main { case class IntAnyVal(x: Int) extends AnyVal val Ten = IntAnyVal(10) - def fail5(x: IntAnyVal) = (x: @switch) match { // error: Could not emit switch for @switch annotated match + def fail5(x: IntAnyVal) = (x: @switch) match { // warn: Could not emit switch for @switch annotated match case IntAnyVal(1) => 0 case Ten => 1 case IntAnyVal(100) => 2 @@ -92,7 +92,7 @@ object Main { // the generated lookupswitch covers only a subset of the cases final val One = IntAnyVal(1) - def fail6(x: IntAnyVal) = (x: @switch) match { // error: Could not emit switch for @switch annotated match + def fail6(x: IntAnyVal) = (x: @switch) match { // warn: Could not emit switch for @switch annotated match case One => 0 case IntAnyVal(10) => 1 case IntAnyVal(100) => 2 @@ -100,3 +100,4 @@ object Main { case IntAnyVal(10000) => 4 } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/symbolic-packages.check b/tests/neg/symbolic-packages.check index 8e9b7e114829..4a0e99f22a85 100644 --- a/tests/neg/symbolic-packages.check +++ b/tests/neg/symbolic-packages.check @@ -1,16 +1,17 @@ --- Error: tests/neg/symbolic-packages.scala:3:8 ------------------------------------------------------------------------ -3 |package `with spaces` { // error +-- Warning: tests/neg/symbolic-packages.scala:3:8 ---------------------------------------------------------------------- +3 |package `with spaces` { // warn | ^^^^^^^^^^^^^ | The package name `with spaces` will be encoded on the classpath, and can lead to undefined behaviour. --- Error: tests/neg/symbolic-packages.scala:7:10 ----------------------------------------------------------------------- -7 |package +.* { // error // error +-- Warning: tests/neg/symbolic-packages.scala:7:10 --------------------------------------------------------------------- +7 |package +.* { // warn // warn | ^ | The package name `*` will be encoded on the classpath, and can lead to undefined behaviour. --- Error: tests/neg/symbolic-packages.scala:7:8 ------------------------------------------------------------------------ -7 |package +.* { // error // error +-- Warning: tests/neg/symbolic-packages.scala:7:8 ---------------------------------------------------------------------- +7 |package +.* { // warn // warn | ^ | The package name `+` will be encoded on the classpath, and can lead to undefined behaviour. --- Error: tests/neg/symbolic-packages.scala:11:16 ---------------------------------------------------------------------- -11 |package object `mixed_*` { // error +-- Warning: tests/neg/symbolic-packages.scala:11:16 -------------------------------------------------------------------- +11 |package object `mixed_*` { // warn | ^^^^^^^ | The package name `mixed_*` will be encoded on the classpath, and can lead to undefined behaviour. +No warnings can be incurred under -Werror. diff --git a/tests/neg/symbolic-packages.scala b/tests/neg/symbolic-packages.scala index 12719d027b4c..557fb06f68a9 100644 --- a/tests/neg/symbolic-packages.scala +++ b/tests/neg/symbolic-packages.scala @@ -1,13 +1,14 @@ //> using options -Xfatal-warnings -package `with spaces` { // error +package `with spaces` { // warn class Foo } -package +.* { // error // error +package +.* { // warn // warn class Bar } -package object `mixed_*` { // error +package object `mixed_*` { // warn class Baz } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/t3235-minimal.check b/tests/neg/t3235-minimal.check index 83c287f85bc0..989af71b5355 100644 --- a/tests/neg/t3235-minimal.check +++ b/tests/neg/t3235-minimal.check @@ -1,16 +1,17 @@ --- Error: tests/neg/t3235-minimal.scala:5:21 --------------------------------------------------------------------------- -5 | assert(123456789.round == 123456789) // error +-- Deprecation Warning: tests/neg/t3235-minimal.scala:5:21 ------------------------------------------------------------- +5 | assert(123456789.round == 123456789) // warn | ^^^^^^^^^^^^^^^ |method round in class RichInt is deprecated since 2.11.0: this is an integer type; there is no reason to round it. Perhaps you meant to call this on a floating-point value? --- Error: tests/neg/t3235-minimal.scala:6:16 --------------------------------------------------------------------------- -6 | assert(math.round(123456789) == 123456789) // error +-- Deprecation Warning: tests/neg/t3235-minimal.scala:6:16 ------------------------------------------------------------- +6 | assert(math.round(123456789) == 123456789) // warn | ^^^^^^^^^^ |method round in package scala.math is deprecated since 2.11.0: This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value? --- Error: tests/neg/t3235-minimal.scala:7:32 --------------------------------------------------------------------------- -7 | assert(1234567890123456789L.round == 1234567890123456789L) // error +-- Deprecation Warning: tests/neg/t3235-minimal.scala:7:32 ------------------------------------------------------------- +7 | assert(1234567890123456789L.round == 1234567890123456789L) // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |method round in class RichLong is deprecated since 2.11.0: this is an integer type; there is no reason to round it. Perhaps you meant to call this on a floating-point value? --- Error: tests/neg/t3235-minimal.scala:8:16 --------------------------------------------------------------------------- -8 | assert(math.round(1234567890123456789L) == 1234567890123456789L) // error +-- Deprecation Warning: tests/neg/t3235-minimal.scala:8:16 ------------------------------------------------------------- +8 | assert(math.round(1234567890123456789L) == 1234567890123456789L) // warn | ^^^^^^^^^^ |method round in package scala.math is deprecated since 2.11.0: This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value? +No warnings can be incurred under -Werror. diff --git a/tests/neg/t3235-minimal.scala b/tests/neg/t3235-minimal.scala index f65ee13f87f5..27448da4b80b 100644 --- a/tests/neg/t3235-minimal.scala +++ b/tests/neg/t3235-minimal.scala @@ -2,9 +2,10 @@ object Test { def main(args: Array[String]): Unit = { - assert(123456789.round == 123456789) // error - assert(math.round(123456789) == 123456789) // error - assert(1234567890123456789L.round == 1234567890123456789L) // error - assert(math.round(1234567890123456789L) == 1234567890123456789L) // error + assert(123456789.round == 123456789) // warn + assert(math.round(123456789) == 123456789) // warn + assert(1234567890123456789L.round == 1234567890123456789L) // warn + assert(math.round(1234567890123456789L) == 1234567890123456789L) // warn } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/t5830.scala b/tests/neg/t5830.scala index 947b7bac4a22..dc6e51ed1f3d 100644 --- a/tests/neg/t5830.scala +++ b/tests/neg/t5830.scala @@ -5,7 +5,9 @@ import scala.annotation.switch class Test { def unreachable(ch: Char) = (ch: @switch) match { case 'a' => println("b") // ok - case 'a' => println("b") // error: unreachable case + case 'a' => println("b") // warn: unreachable case case 'c' => } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/type-test-paths-2.scala b/tests/neg/type-test-paths-2.scala index 4bba2f87416e..5a68c1607bfd 100644 --- a/tests/neg/type-test-paths-2.scala +++ b/tests/neg/type-test-paths-2.scala @@ -29,15 +29,16 @@ object Test { val r2: R = RI r1.n match { - case n: r2.Nat => // error: the type test for Test.r2.Nat cannot be checked at runtime - case n: r1.Idx => // error: the type test for Test.r1.Idx cannot be checked at runtime + case n: r2.Nat => // warn: the type test for Test.r2.Nat cannot be checked at runtime + case n: r1.Idx => // warn: the type test for Test.r1.Idx cannot be checked at runtime case n: r1.Succ => // Ok case n: r1.Nat => // Ok } r1.one match { - case n: r2.Nat => // error: the type test for Test.r2.Nat cannot be checked at runtime - case n: r1.Idx => // error: the type test for Test.r1.Idx cannot be checked at runtime + case n: r2.Nat => // warn: the type test for Test.r2.Nat cannot be checked at runtime + case n: r1.Idx => // warn: the type test for Test.r1.Idx cannot be checked at runtime case n: r1.Nat => // Ok } } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/type-test-paths.scala b/tests/neg/type-test-paths.scala index 324ed43ba7fa..e8c9d2879e6d 100644 --- a/tests/neg/type-test-paths.scala +++ b/tests/neg/type-test-paths.scala @@ -8,7 +8,7 @@ object Test { val p2: T = T1 (p1.y: p1.X) match { - case x: p2.Y => // error: unchecked + case x: p2.Y => // warn: unchecked case x: p1.Y => case _ => } @@ -37,3 +37,5 @@ object T1 extends T { } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/type-test-syntesize-b.scala b/tests/neg/type-test-syntesize-b.scala index 79be9357387e..ab3b970f79f8 100644 --- a/tests/neg/type-test-syntesize-b.scala +++ b/tests/neg/type-test-syntesize-b.scala @@ -19,9 +19,9 @@ object Test { test[Any, Array[Int]] test[Seq[Int], List[Int]] - test[Any, Some[Int]] // error - test[Any, a.X] // error - test[a.X, a.Y] // error + test[Any, Some[Int]] // warn + test[Any, a.X] // warn + test[a.X, a.Y] // warn } @@ -29,3 +29,4 @@ class A { type X type Y <: X } +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/unchecked-patterns.scala b/tests/neg/unchecked-patterns.scala index db304a2f1875..7e6c4de76a50 100644 --- a/tests/neg/unchecked-patterns.scala +++ b/tests/neg/unchecked-patterns.scala @@ -5,23 +5,24 @@ object Test { val (y1: Some[Int]) = Some(1): Option[Int] @unchecked // OK val y2: Some[Int] @unchecked = Some(1): Option[Int] // error - val x :: xs = List(1, 2, 3) // error - val (1, c) = (1, 2) // error - val 1 *: cs = 1 *: Tuple() // error + val x :: xs = List(1, 2, 3) // warn + val (1, c) = (1, 2) // warn + val 1 *: cs = 1 *: Tuple() // warn - val (_: Int | _: AnyRef) = ??? : AnyRef // error + val (_: Int | _: AnyRef) = ??? : AnyRef // warn - val 1 = 2 // error + val 1 = 2 // warn object Positive { def unapply(i: Int): Option[Int] = Some(i).filter(_ > 0) } object Always1 { def unapply(i: Int): Some[Int] = Some(i) } object Pair { def unapply(t: (Int, Int)): t.type = t } object Triple { def unapply(t: (Int, Int, Int)): (Int, Int, Int) = t } - val Positive(p) = 5 // error - val Some(s1) = Option(1) // error + val Positive(p) = 5 // warn + val Some(s1) = Option(1) // warn val Some(s2) = Some(1) // OK val Always1(p1) = 5 // OK val Pair(t1, t2) = (5, 5) // OK val Triple(u1, u2, u3) = (5, 5, 5) // OK -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/warn-value-discard.check b/tests/neg/warn-value-discard.check index ba43c743709f..f803179d1c3a 100644 --- a/tests/neg/warn-value-discard.check +++ b/tests/neg/warn-value-discard.check @@ -1,20 +1,21 @@ --- [E175] Potential Issue Error: tests/neg/warn-value-discard.scala:27:36 ---------------------------------------------- -27 | mutable.Set.empty[String].remove("") // error +-- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:27:36 -------------------------------------------- +27 | mutable.Set.empty[String].remove("") // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | discarded non-Unit value of type Boolean --- [E175] Potential Issue Error: tests/neg/warn-value-discard.scala:39:41 ---------------------------------------------- -39 | mutable.Set.empty[String].subtractOne("") // error +-- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:39:41 -------------------------------------------- +39 | mutable.Set.empty[String].subtractOne("") // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | discarded non-Unit value of type scala.collection.mutable.Set[String] --- [E175] Potential Issue Error: tests/neg/warn-value-discard.scala:59:4 ----------------------------------------------- -59 | mutable.Set.empty[String] += "" // error +-- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:59:4 --------------------------------------------- +59 | mutable.Set.empty[String] += "" // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | discarded non-Unit value of type scala.collection.mutable.Set[String] --- [E175] Potential Issue Error: tests/neg/warn-value-discard.scala:15:35 ---------------------------------------------- -15 | firstThing().map(_ => secondThing()) // error +-- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:15:35 -------------------------------------------- +15 | firstThing().map(_ => secondThing()) // warn | ^^^^^^^^^^^^^ | discarded non-Unit value of type Either[Failed, Unit] --- [E175] Potential Issue Error: tests/neg/warn-value-discard.scala:18:35 ---------------------------------------------- -18 | firstThing().map(_ => secondThing()) // error +-- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:18:35 -------------------------------------------- +18 | firstThing().map(_ => secondThing()) // warn | ^^^^^^^^^^^^^ | discarded non-Unit value of type Either[Failed, Unit] +No warnings can be incurred under -Werror. diff --git a/tests/neg/warn-value-discard.scala b/tests/neg/warn-value-discard.scala index fb01fdeda384..5bfb81b2fb65 100644 --- a/tests/neg/warn-value-discard.scala +++ b/tests/neg/warn-value-discard.scala @@ -12,10 +12,10 @@ def secondThing(): Either[Failed, Unit] = Left(Failed("whoops you should have flatMapped me")) def singleExpr(): Either[Failed, Unit] = - firstThing().map(_ => secondThing()) // error + firstThing().map(_ => secondThing()) // warn def block(): Either[Failed, Unit] = { - firstThing().map(_ => secondThing()) // error + firstThing().map(_ => secondThing()) // warn } class ValueDiscardTest: @@ -24,7 +24,7 @@ class ValueDiscardTest: def remove(): Unit = // Set#remove returns a Boolean, not this.type // --> Warning - mutable.Set.empty[String].remove("") // error + mutable.Set.empty[String].remove("") // warn // TODO IMHO we don't need to support this, // as it's just as easy to add a @nowarn annotation as a Unit ascription @@ -36,7 +36,7 @@ class ValueDiscardTest: // - Set#subtractOne returns this.type // - receiver is not a field or a local variable (not quite sure what you'd call it) // --> Warning - mutable.Set.empty[String].subtractOne("") // error + mutable.Set.empty[String].subtractOne("") // warn def mutateLocalVariable(): Unit = { // - Set#subtractOne returns this.type @@ -56,7 +56,7 @@ class ValueDiscardTest: // - += returns this.type // - receiver is not a field or a local variable // --> Warning - mutable.Set.empty[String] += "" // error + mutable.Set.empty[String] += "" // warn def assignmentOperatorLocalVariable(): Unit = // - += returns this.type @@ -64,3 +64,4 @@ class ValueDiscardTest: // --> 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 diff --git a/tests/neg/with-type-operator-future-migration.check b/tests/neg/with-type-operator-future-migration.check index 29ea1d5aad4c..4dbcd993f242 100644 --- a/tests/neg/with-type-operator-future-migration.check +++ b/tests/neg/with-type-operator-future-migration.check @@ -1,7 +1,8 @@ --- [E003] Syntax Error: tests/neg/with-type-operator-future-migration.scala:5:13 --------------------------------------- -5 |def foo: Int with String = ??? // error +-- [E003] Syntax Migration Warning: tests/neg/with-type-operator-future-migration.scala:5:13 --------------------------- +5 |def foo: Int with String = ??? // warn | ^ | with as a type operator has been deprecated; use & instead | This construct can be rewritten automatically under -rewrite -source future-migration. | | longer explanation available when compiling with `-explain` +No warnings can be incurred under -Werror. diff --git a/tests/neg/with-type-operator-future-migration.scala b/tests/neg/with-type-operator-future-migration.scala index 3ed2e3a8f067..dac924603636 100644 --- a/tests/neg/with-type-operator-future-migration.scala +++ b/tests/neg/with-type-operator-future-migration.scala @@ -2,4 +2,6 @@ import scala.language.`future-migration` -def foo: Int with String = ??? // error +def foo: Int with String = ??? // warn + +// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/xfatalWarnings.scala b/tests/neg/xfatalWarnings.scala index 3f49e159cbc4..13763bf3b48d 100644 --- a/tests/neg/xfatalWarnings.scala +++ b/tests/neg/xfatalWarnings.scala @@ -3,7 +3,7 @@ object xfatalWarnings { val opt:Option[String] = Some("test") - opt match { // error when running with -Xfatal-warnings + opt match { // warn case None => } @@ -11,3 +11,6 @@ object xfatalWarnings { while (true) {} // should be ok. no "pure expression does nothing in statement position" issued. } } + +// When running with fatal warnings: +// nopos-error: No warnings can be incurred under -Werror. From a9a67d5abdd89a876661e7d04fd074c183acb037 Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Fri, 3 Nov 2023 14:42:23 +0100 Subject: [PATCH 03/11] Move warn tests to warn --- tests/neg-deep-subtype/i3324.scala | 8 -------- tests/neg/i10994.scala | 6 ------ tests/neg/i11963a.scala | 5 ----- tests/neg/i11963b.scala | 5 ----- tests/neg/i11963c.scala | 10 ---------- tests/neg/i14705.scala | 7 ------- tests/neg/i2673.scala | 8 -------- tests/neg/i2673b.scala | 8 -------- tests/neg/i2673c.scala | 10 ---------- tests/neg/i4936b.scala | 5 ----- tests/neg/i6190b.scala | 7 ------- tests/neg/i9266.scala | 7 ------- tests/neg/i9751.scala | 12 ------------ tests/neg/manifest-summoning-b.scala | 5 ----- tests/neg/old-syntax.scala | 6 ------ tests/neg/ovlazy.scala | 10 ---------- tests/{neg => warn}/14034b.scala | 5 ++--- tests/{neg-deep-subtype => warn}/1828.scala | 4 +--- tests/{neg-deep-subtype => warn}/3324b.scala | 5 ++--- tests/{neg-deep-subtype => warn}/3324f.scala | 5 ++--- tests/{neg-deep-subtype => warn}/3324g.scala | 5 ++--- tests/{neg => warn}/IsInstanceOfClassTag2.scala | 3 +-- .../{neg-deep-subtype => warn}/JavaSeqLiteral.scala | 4 +--- tests/{neg => warn}/avoid-warn-deprecation.scala | 5 ++--- .../conditionalWarnings.scala | 5 ++--- tests/{neg => warn}/convertible.scala | 5 ++--- tests/{neg => warn}/deprecated-override.scala | 5 ++--- tests/{neg => warn}/feature-shadowing.scala | 3 +-- tests/{neg => warn}/gadt-contradictory-pattern.scala | 5 ++--- tests/{neg-deep-subtype => warn}/gadt.scala | 4 +--- tests/{neg-deep-subtype => warn}/html.scala | 4 +--- tests/{neg => warn}/i10247.scala | 5 ++--- tests/{neg => warn}/i10930.scala | 5 ++--- tests/warn/i10994.scala | 5 +++++ tests/{neg => warn}/i11022.scala | 5 ++--- tests/{neg => warn}/i11097.scala | 5 ++--- tests/{neg => warn}/i11225b.scala | 3 +-- tests/{neg => warn}/i11333.scala | 5 ++--- tests/{neg => warn}/i11344.scala | 3 +-- tests/warn/i11963a.scala | 4 ++++ tests/warn/i11963b.scala | 4 ++++ tests/warn/i11963c.scala | 8 ++++++++ tests/{neg => warn}/i12253.scala | 4 +--- tests/{neg => warn}/i12597.scala | 3 +-- tests/{neg => warn}/i13011.scala | 5 ++--- tests/{neg => warn}/i13440.scala | 5 ++--- tests/{neg => warn}/i13542.scala | 5 ++--- tests/warn/i14705.scala | 6 ++++++ tests/{neg => warn}/i14721.scala | 3 +-- tests/{neg => warn}/i15474.scala | 5 ++--- tests/{neg => warn}/i15479.scala | 4 +--- tests/{neg => warn}/i15503a.scala | 5 ++--- tests/{neg => warn}/i15503b.scala | 5 ++--- tests/{neg => warn}/i15503c.scala | 5 ++--- tests/{neg => warn}/i15503d.scala | 5 ++--- tests/{neg => warn}/i15503e.scala | 5 ++--- tests/{neg => warn}/i15503f.scala | 4 +--- tests/{neg => warn}/i15503g.scala | 5 ++--- tests/{neg => warn}/i15503h.scala | 5 ++--- tests/{neg => warn}/i15503j.scala | 5 ++--- tests/{neg => warn}/i15662.scala | 4 +--- tests/{neg => warn}/i16639a.scala | 5 ++--- tests/{neg => warn}/i16649-refutable.scala | 3 +-- tests/{neg => warn}/i16728.scala | 4 +--- tests/{neg => warn}/i16930.scala | 5 ++--- tests/{neg => warn}/i17314b.scala | 3 +-- tests/{neg => warn}/i17612a.scala | 5 ++--- tests/{neg => warn}/i17613a.scala | 5 ++--- tests/{neg => warn}/i2333.scala | 5 ++--- tests/warn/i2673.scala | 6 ++++++ tests/warn/i2673b.scala | 7 +++++++ tests/warn/i2673c.scala | 9 +++++++++ tests/warn/i3324.scala | 6 ++++++ tests/{neg => warn}/i3561.scala | 5 ++--- tests/{neg => warn}/i4008.scala | 5 ++--- tests/{neg-deep-subtype => warn}/i4297.scala | 5 ++--- tests/{neg => warn}/i4364.scala | 4 +--- tests/warn/i4936b.scala | 3 +++ tests/{neg => warn}/i4986b.scala | 5 ++--- tests/{neg => warn}/i5013.scala | 5 ++--- tests/{neg => warn}/i5013b.scala | 3 +-- tests/warn/i6190b.scala | 6 ++++++ tests/{neg => warn}/i7314.scala | 4 +--- tests/{neg => warn}/i7821.scala | 3 +-- tests/{neg => warn}/i7821b.scala | 5 ++--- tests/{neg => warn}/i8427.scala | 3 +-- tests/{neg => warn}/i8781b.scala | 3 +-- tests/{neg => warn}/i8922b.scala | 4 +--- tests/{neg => warn}/i9166.scala | 3 +-- tests/{neg => warn}/i9241.scala | 5 ++--- tests/warn/i9266.scala | 6 ++++++ tests/{neg => warn}/i9408a.scala | 5 ++--- tests/{neg => warn}/i9740.scala | 5 ++--- tests/{neg => warn}/i9740b.scala | 5 ++--- tests/{neg => warn}/i9740c.scala | 3 +-- tests/{neg => warn}/i9740d.scala | 3 +-- tests/warn/i9751.scala | 11 +++++++++++ tests/{neg => warn}/i9776.scala | 5 ++--- tests/{neg => warn}/i9880.scala | 5 ++--- tests/{neg => warn}/implicit-conversions-old.scala | 5 ++--- tests/{neg => warn}/implicit-conversions.scala | 5 ++--- tests/{neg => warn}/infix.scala | 5 ++--- tests/{neg => warn}/inline-givens.scala | 5 ++--- tests/{neg => warn}/main-functions-nameclash.scala | 4 +--- tests/warn/manifest-summoning-b.scala | 4 ++++ tests/{neg => warn}/matchable.scala | 5 ++--- tests/{neg => warn}/newline-braces.scala | 3 +-- tests/{neg => warn}/nonunit-statement.scala | 5 ++--- tests/warn/old-syntax.scala | 5 +++++ tests/{neg => warn}/opaque-match.scala | 5 ++--- tests/{neg-deep-subtype => warn}/or-type-trees.scala | 5 ++--- tests/warn/ovlazy.scala | 9 +++++++++ tests/{neg => warn}/quote-simple-hole.scala | 5 ++--- tests/{neg-deep-subtype => warn}/refined-types.scala | 5 ++--- tests/{neg => warn}/refinements-this.scala | 3 +-- .../{neg => warn}/strict-pattern-bindings-3.2.scala | 5 ++--- tests/{neg => warn}/supertraits-b.scala | 5 ++--- tests/{neg => warn}/switches.scala | 5 ++--- tests/{neg => warn}/symbolic-packages.scala | 5 ++--- tests/{neg-deep-subtype => warn}/t2755.scala | 5 ++--- tests/{neg => warn}/t3235-minimal.scala | 5 ++--- tests/{neg => warn}/t5830.scala | 4 +--- tests/{neg-deep-subtype => warn}/type-lambda.scala | 4 +--- tests/{neg => warn}/type-test-paths-2.scala | 5 ++--- tests/{neg => warn}/type-test-paths.scala | 4 +--- tests/{neg => warn}/type-test-syntesize-b.scala | 5 ++--- tests/{neg => warn}/xfatalWarnings.scala | 3 +-- 127 files changed, 255 insertions(+), 386 deletions(-) delete mode 100644 tests/neg-deep-subtype/i3324.scala delete mode 100644 tests/neg/i10994.scala delete mode 100644 tests/neg/i11963a.scala delete mode 100644 tests/neg/i11963b.scala delete mode 100644 tests/neg/i11963c.scala delete mode 100644 tests/neg/i14705.scala delete mode 100644 tests/neg/i2673.scala delete mode 100644 tests/neg/i2673b.scala delete mode 100644 tests/neg/i2673c.scala delete mode 100644 tests/neg/i4936b.scala delete mode 100644 tests/neg/i6190b.scala delete mode 100644 tests/neg/i9266.scala delete mode 100644 tests/neg/i9751.scala delete mode 100644 tests/neg/manifest-summoning-b.scala delete mode 100644 tests/neg/old-syntax.scala delete mode 100644 tests/neg/ovlazy.scala rename tests/{neg => warn}/14034b.scala (66%) rename tests/{neg-deep-subtype => warn}/1828.scala (69%) rename tests/{neg-deep-subtype => warn}/3324b.scala (74%) rename tests/{neg-deep-subtype => warn}/3324f.scala (59%) rename tests/{neg-deep-subtype => warn}/3324g.scala (77%) rename tests/{neg => warn}/IsInstanceOfClassTag2.scala (82%) rename tests/{neg-deep-subtype => warn}/JavaSeqLiteral.scala (83%) rename tests/{neg => warn}/avoid-warn-deprecation.scala (58%) rename tests/{neg-deep-subtype => warn}/conditionalWarnings.scala (74%) rename tests/{neg => warn}/convertible.scala (85%) rename tests/{neg => warn}/deprecated-override.scala (52%) rename tests/{neg => warn}/feature-shadowing.scala (74%) rename tests/{neg => warn}/gadt-contradictory-pattern.scala (73%) rename tests/{neg-deep-subtype => warn}/gadt.scala (65%) rename tests/{neg-deep-subtype => warn}/html.scala (84%) rename tests/{neg => warn}/i10247.scala (84%) rename tests/{neg => warn}/i10930.scala (72%) create mode 100644 tests/warn/i10994.scala rename tests/{neg => warn}/i11022.scala (71%) rename tests/{neg => warn}/i11097.scala (83%) rename tests/{neg => warn}/i11225b.scala (63%) rename tests/{neg => warn}/i11333.scala (71%) rename tests/{neg => warn}/i11344.scala (60%) create mode 100644 tests/warn/i11963a.scala create mode 100644 tests/warn/i11963b.scala create mode 100644 tests/warn/i11963c.scala rename tests/{neg => warn}/i12253.scala (91%) rename tests/{neg => warn}/i12597.scala (54%) rename tests/{neg => warn}/i13011.scala (86%) rename tests/{neg => warn}/i13440.scala (57%) rename tests/{neg => warn}/i13542.scala (89%) create mode 100644 tests/warn/i14705.scala rename tests/{neg => warn}/i14721.scala (65%) rename tests/{neg => warn}/i15474.scala (81%) rename tests/{neg => warn}/i15479.scala (69%) rename tests/{neg => warn}/i15503a.scala (97%) rename tests/{neg => warn}/i15503b.scala (94%) rename tests/{neg => warn}/i15503c.scala (90%) rename tests/{neg => warn}/i15503d.scala (83%) rename tests/{neg => warn}/i15503e.scala (92%) rename tests/{neg => warn}/i15503f.scala (79%) rename tests/{neg => warn}/i15503g.scala (85%) rename tests/{neg => warn}/i15503h.scala (74%) rename tests/{neg => warn}/i15503j.scala (88%) rename tests/{neg => warn}/i15662.scala (78%) rename tests/{neg => warn}/i16639a.scala (97%) rename tests/{neg => warn}/i16649-refutable.scala (63%) rename tests/{neg => warn}/i16728.scala (85%) rename tests/{neg => warn}/i16930.scala (79%) rename tests/{neg => warn}/i17314b.scala (65%) rename tests/{neg => warn}/i17612a.scala (91%) rename tests/{neg => warn}/i17613a.scala (84%) rename tests/{neg => warn}/i2333.scala (60%) create mode 100644 tests/warn/i2673.scala create mode 100644 tests/warn/i2673b.scala create mode 100644 tests/warn/i2673c.scala create mode 100644 tests/warn/i3324.scala rename tests/{neg => warn}/i3561.scala (80%) rename tests/{neg => warn}/i4008.scala (93%) rename tests/{neg-deep-subtype => warn}/i4297.scala (88%) rename tests/{neg => warn}/i4364.scala (75%) create mode 100644 tests/warn/i4936b.scala rename tests/{neg => warn}/i4986b.scala (89%) rename tests/{neg => warn}/i5013.scala (73%) rename tests/{neg => warn}/i5013b.scala (75%) create mode 100644 tests/warn/i6190b.scala rename tests/{neg => warn}/i7314.scala (69%) rename tests/{neg => warn}/i7821.scala (83%) rename tests/{neg => warn}/i7821b.scala (80%) rename tests/{neg => warn}/i8427.scala (60%) rename tests/{neg => warn}/i8781b.scala (54%) rename tests/{neg => warn}/i8922b.scala (97%) rename tests/{neg => warn}/i9166.scala (53%) rename tests/{neg => warn}/i9241.scala (90%) create mode 100644 tests/warn/i9266.scala rename tests/{neg => warn}/i9408a.scala (94%) rename tests/{neg => warn}/i9740.scala (81%) rename tests/{neg => warn}/i9740b.scala (79%) rename tests/{neg => warn}/i9740c.scala (76%) rename tests/{neg => warn}/i9740d.scala (71%) create mode 100644 tests/warn/i9751.scala rename tests/{neg => warn}/i9776.scala (93%) rename tests/{neg => warn}/i9880.scala (85%) rename tests/{neg => warn}/implicit-conversions-old.scala (81%) rename tests/{neg => warn}/implicit-conversions.scala (81%) rename tests/{neg => warn}/infix.scala (92%) rename tests/{neg => warn}/inline-givens.scala (67%) rename tests/{neg => warn}/main-functions-nameclash.scala (56%) create mode 100644 tests/warn/manifest-summoning-b.scala rename tests/{neg => warn}/matchable.scala (84%) rename tests/{neg => warn}/newline-braces.scala (55%) rename tests/{neg => warn}/nonunit-statement.scala (97%) create mode 100644 tests/warn/old-syntax.scala rename tests/{neg => warn}/opaque-match.scala (75%) rename tests/{neg-deep-subtype => warn}/or-type-trees.scala (90%) create mode 100644 tests/warn/ovlazy.scala rename tests/{neg => warn}/quote-simple-hole.scala (77%) rename tests/{neg-deep-subtype => warn}/refined-types.scala (90%) rename tests/{neg => warn}/refinements-this.scala (52%) rename tests/{neg => warn}/strict-pattern-bindings-3.2.scala (90%) rename tests/{neg => warn}/supertraits-b.scala (84%) rename tests/{neg => warn}/switches.scala (97%) rename tests/{neg => warn}/symbolic-packages.scala (59%) rename tests/{neg-deep-subtype => warn}/t2755.scala (95%) rename tests/{neg => warn}/t3235-minimal.scala (74%) rename tests/{neg => warn}/t5830.scala (69%) rename tests/{neg-deep-subtype => warn}/type-lambda.scala (74%) rename tests/{neg => warn}/type-test-paths-2.scala (91%) rename tests/{neg => warn}/type-test-paths.scala (87%) rename tests/{neg => warn}/type-test-syntesize-b.scala (82%) rename tests/{neg => warn}/xfatalWarnings.scala (74%) diff --git a/tests/neg-deep-subtype/i3324.scala b/tests/neg-deep-subtype/i3324.scala deleted file mode 100644 index 154f0e5eb64d..000000000000 --- a/tests/neg-deep-subtype/i3324.scala +++ /dev/null @@ -1,8 +0,0 @@ -//> using options -Xfatal-warnings - -class Foo { - def foo(x: Any): Boolean = - x.isInstanceOf[List[String]] // warn -} - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i10994.scala b/tests/neg/i10994.scala deleted file mode 100644 index ce553c77c5ae..000000000000 --- a/tests/neg/i10994.scala +++ /dev/null @@ -1,6 +0,0 @@ -//> using options -Xfatal-warnings - -def foo = true match - case (b: Boolean): Boolean => () // warn - -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i11963a.scala b/tests/neg/i11963a.scala deleted file mode 100644 index 5212a51826c4..000000000000 --- a/tests/neg/i11963a.scala +++ /dev/null @@ -1,5 +0,0 @@ -//> using options -Xfatal-warnings - -open trait Foo // warn - -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i11963b.scala b/tests/neg/i11963b.scala deleted file mode 100644 index e549488b79b7..000000000000 --- a/tests/neg/i11963b.scala +++ /dev/null @@ -1,5 +0,0 @@ -//> using options -Xfatal-warnings - -open abstract class Foo // warn - -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i11963c.scala b/tests/neg/i11963c.scala deleted file mode 100644 index 8e91632f0bc2..000000000000 --- a/tests/neg/i11963c.scala +++ /dev/null @@ -1,10 +0,0 @@ -//> using options -Xfatal-warnings - -object Test { - def foo: Any = { - open class Bar // warn - new Bar - } -} - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i14705.scala b/tests/neg/i14705.scala deleted file mode 100644 index 36646130a8a8..000000000000 --- a/tests/neg/i14705.scala +++ /dev/null @@ -1,7 +0,0 @@ -//> using options -Xfatal-warnings - -val n = Nil -val b = n.head.isInstanceOf[String] // warn - -// nopos-error: No warnings can be incurred under -Werror. - diff --git a/tests/neg/i2673.scala b/tests/neg/i2673.scala deleted file mode 100644 index 77abe1a06d16..000000000000 --- a/tests/neg/i2673.scala +++ /dev/null @@ -1,8 +0,0 @@ -//> using options -Xfatal-warnings - -package Foos - -class Foo // warn -class foo - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i2673b.scala b/tests/neg/i2673b.scala deleted file mode 100644 index 6481ab469943..000000000000 --- a/tests/neg/i2673b.scala +++ /dev/null @@ -1,8 +0,0 @@ -//> using options -Xfatal-warnings - -package Foos - -class Bar // warn -object bar - -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i2673c.scala b/tests/neg/i2673c.scala deleted file mode 100644 index 46e8ff828c18..000000000000 --- a/tests/neg/i2673c.scala +++ /dev/null @@ -1,10 +0,0 @@ -//> using options -Xfatal-warnings - -package Foos - -object Outer { - case class X() // warn - object x -} - -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i4936b.scala b/tests/neg/i4936b.scala deleted file mode 100644 index 80d9de8aeb7d..000000000000 --- a/tests/neg/i4936b.scala +++ /dev/null @@ -1,5 +0,0 @@ -//> using options -Xfatal-warnings - -final object Foo // warn - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i6190b.scala b/tests/neg/i6190b.scala deleted file mode 100644 index 2f81d0a5a759..000000000000 --- a/tests/neg/i6190b.scala +++ /dev/null @@ -1,7 +0,0 @@ -//> using options -Xfatal-warnings - -case class Rule(name: String) - -def foo = List("1", "2").map(Rule) // warn - -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i9266.scala b/tests/neg/i9266.scala deleted file mode 100644 index 168f1fa1b551..000000000000 --- a/tests/neg/i9266.scala +++ /dev/null @@ -1,7 +0,0 @@ -//> using options -Xfatal-warnings - -import language.`future-migration` - -def test = { implicit x: Int => x + x } // warn - -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i9751.scala b/tests/neg/i9751.scala deleted file mode 100644 index 1b3fa1a01656..000000000000 --- a/tests/neg/i9751.scala +++ /dev/null @@ -1,12 +0,0 @@ -//> using options -Xfatal-warnings - -def f(): Unit = { - () // warn - () -} - -inline def g(): Unit = { - () // warn - () -} -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/manifest-summoning-b.scala b/tests/neg/manifest-summoning-b.scala deleted file mode 100644 index 83e8b69ead00..000000000000 --- a/tests/neg/manifest-summoning-b.scala +++ /dev/null @@ -1,5 +0,0 @@ -//> using options -Xfatal-warnings -deprecation - -val foo = manifest[List[? <: Int]] // warn -val bar = optManifest[Array[? <: String]] // warn -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/old-syntax.scala b/tests/neg/old-syntax.scala deleted file mode 100644 index 4f031c96c4c4..000000000000 --- a/tests/neg/old-syntax.scala +++ /dev/null @@ -1,6 +0,0 @@ -//> using options -Xfatal-warnings -deprecation - -val f = (x: Int) ⇒ x + 1 // warn - -val list = for (n ← List(42)) yield n + 1 // warn -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/ovlazy.scala b/tests/neg/ovlazy.scala deleted file mode 100644 index 1331589c5d3b..000000000000 --- a/tests/neg/ovlazy.scala +++ /dev/null @@ -1,10 +0,0 @@ -//> using options -source 3.0-migration -Xfatal-warnings - -class A { - val x: Int = 1 -} -class B extends A { - override lazy val x: Int = 2 // warn -} - -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/14034b.scala b/tests/warn/14034b.scala similarity index 66% rename from tests/neg/14034b.scala rename to tests/warn/14034b.scala index 7f9f4e8f1cac..fdef353f7aca 100644 --- a/tests/neg/14034b.scala +++ b/tests/warn/14034b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation +//> using options -deprecation @deprecated trait Exp @deprecated val exp = 1 @@ -12,5 +12,4 @@ type Bar = Option[exp.type] // warn type Baz = Exp | Int // warn type Quux = [X] =>> X match case Exp => Int // warn -type Quuz[A <: Exp] = Int // warn -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +type Quuz[A <: Exp] = Int // warn \ No newline at end of file diff --git a/tests/neg-deep-subtype/1828.scala b/tests/warn/1828.scala similarity index 69% rename from tests/neg-deep-subtype/1828.scala rename to tests/warn/1828.scala index 9cab8e76e832..2231967a53e0 100644 --- a/tests/neg-deep-subtype/1828.scala +++ b/tests/warn/1828.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class Test { def remove[S](a: S | Int, f: Int => S):S = a match { @@ -9,5 +9,3 @@ class Test { val t: Int | String = 5 val t1 = remove[String](t, _.toString) } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/3324b.scala b/tests/warn/3324b.scala similarity index 74% rename from tests/neg-deep-subtype/3324b.scala rename to tests/warn/3324b.scala index 71ffde73fbdc..9a2011d18012 100644 --- a/tests/neg-deep-subtype/3324b.scala +++ b/tests/warn/3324b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class C[T] { val x: Any = ??? @@ -8,5 +8,4 @@ class C[T] { case x: List[String] => // warn: unchecked case x: T => // warn: unchecked } -} -// 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-deep-subtype/3324f.scala b/tests/warn/3324f.scala similarity index 59% rename from tests/neg-deep-subtype/3324f.scala rename to tests/warn/3324f.scala index e73bd0d05eed..86af918b0d5a 100644 --- a/tests/neg-deep-subtype/3324f.scala +++ b/tests/warn/3324f.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + trait C[T] class D[T] @@ -8,5 +8,4 @@ class Test { case _: D[T] => // warn case _: C[Int] => // 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-deep-subtype/3324g.scala b/tests/warn/3324g.scala similarity index 77% rename from tests/neg-deep-subtype/3324g.scala rename to tests/warn/3324g.scala index cd1fc660bed8..23ff4b3d23f9 100644 --- a/tests/neg-deep-subtype/3324g.scala +++ b/tests/warn/3324g.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class Test { trait A[+T] @@ -18,5 +18,4 @@ class Test { } quux(new C[Int]) -} -// 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/IsInstanceOfClassTag2.scala b/tests/warn/IsInstanceOfClassTag2.scala similarity index 82% rename from tests/neg/IsInstanceOfClassTag2.scala rename to tests/warn/IsInstanceOfClassTag2.scala index a2a7194d4e39..c41a94d86c6d 100644 --- a/tests/neg/IsInstanceOfClassTag2.scala +++ b/tests/warn/IsInstanceOfClassTag2.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.reflect.TypeTest @@ -23,4 +23,3 @@ object IsInstanceOfClassTag { } } -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg-deep-subtype/JavaSeqLiteral.scala b/tests/warn/JavaSeqLiteral.scala similarity index 83% rename from tests/neg-deep-subtype/JavaSeqLiteral.scala rename to tests/warn/JavaSeqLiteral.scala index 863b4f436f89..9652a9fa502c 100644 --- a/tests/neg-deep-subtype/JavaSeqLiteral.scala +++ b/tests/warn/JavaSeqLiteral.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + object Test1 { trait Tree[-T] @@ -29,5 +29,3 @@ object Test2 { foo1(new DummyTree) } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/avoid-warn-deprecation.scala b/tests/warn/avoid-warn-deprecation.scala similarity index 58% rename from tests/neg/avoid-warn-deprecation.scala rename to tests/warn/avoid-warn-deprecation.scala index f14ebd30a98f..364added5e8a 100644 --- a/tests/neg/avoid-warn-deprecation.scala +++ b/tests/warn/avoid-warn-deprecation.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -feature +//> using options -feature object A { @deprecated("use bar instead of this one", "0.2.3") @@ -8,5 +8,4 @@ object A { object B { A.foo } -// nopos-warn there was 1 deprecation warning; re-run with -deprecation for details -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +// nopos-warn there was 1 deprecation warning; re-run with -deprecation for details \ No newline at end of file diff --git a/tests/neg-deep-subtype/conditionalWarnings.scala b/tests/warn/conditionalWarnings.scala similarity index 74% rename from tests/neg-deep-subtype/conditionalWarnings.scala rename to tests/warn/conditionalWarnings.scala index c818b70b8ee5..5ab63c263abf 100644 --- a/tests/neg-deep-subtype/conditionalWarnings.scala +++ b/tests/warn/conditionalWarnings.scala @@ -1,4 +1,4 @@ -//> using options -deprecation -Xfatal-warnings +//> using options -deprecation object Test { @deprecated def foo = ??? @@ -12,5 +12,4 @@ object Test { // The program compiles with final line // there was 1 feature warning; re-run with -feature for details // nopos-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/convertible.scala b/tests/warn/convertible.scala similarity index 85% rename from tests/neg/convertible.scala rename to tests/warn/convertible.scala index 9ddc75a982a7..c98006ecdc9b 100644 --- a/tests/neg/convertible.scala +++ b/tests/warn/convertible.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -feature +//> using options -feature import language.experimental.into @@ -27,5 +27,4 @@ object Test: def h(x: into Text) = val y = h1(x) - y("abc") // warn, inference through type variable does not propagate -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + y("abc") // warn, inference through type variable does not propagate \ No newline at end of file diff --git a/tests/neg/deprecated-override.scala b/tests/warn/deprecated-override.scala similarity index 52% rename from tests/neg/deprecated-override.scala rename to tests/warn/deprecated-override.scala index c167dd720666..2d0b0ceb4aea 100644 --- a/tests/neg/deprecated-override.scala +++ b/tests/warn/deprecated-override.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation trait A: def f: Int @@ -12,5 +12,4 @@ class C extends B: trait D extends A: override def f = 3 -object E extends B, D // warn -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +object E extends B, D // warn \ No newline at end of file diff --git a/tests/neg/feature-shadowing.scala b/tests/warn/feature-shadowing.scala similarity index 74% rename from tests/neg/feature-shadowing.scala rename to tests/warn/feature-shadowing.scala index 891d8735aa41..301f24b241f7 100644 --- a/tests/neg/feature-shadowing.scala +++ b/tests/warn/feature-shadowing.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -feature +//> using options -feature import language.implicitConversions given Conversion[Int, String] = _.toString @@ -13,4 +13,3 @@ object a: object c: import language.implicitConversions val s: String = 3 // OK again -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/gadt-contradictory-pattern.scala b/tests/warn/gadt-contradictory-pattern.scala similarity index 73% rename from tests/neg/gadt-contradictory-pattern.scala rename to tests/warn/gadt-contradictory-pattern.scala index ed8b343c9545..b9c004efbe34 100644 --- a/tests/neg/gadt-contradictory-pattern.scala +++ b/tests/warn/gadt-contradictory-pattern.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wimplausible-patterns +//> using options -Wimplausible-patterns object Test { sealed abstract class Foo[T] case object Bar1 extends Foo[Int] @@ -11,5 +11,4 @@ object Test { case (Bar3, _) => () } -} -// 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-deep-subtype/gadt.scala b/tests/warn/gadt.scala similarity index 65% rename from tests/neg-deep-subtype/gadt.scala rename to tests/warn/gadt.scala index ec59ca53572c..9d7b81220284 100644 --- a/tests/neg-deep-subtype/gadt.scala +++ b/tests/warn/gadt.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class Test { trait A[+T] @@ -13,5 +13,3 @@ class Test { quux(new B[D]) } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/html.scala b/tests/warn/html.scala similarity index 84% rename from tests/neg-deep-subtype/html.scala rename to tests/warn/html.scala index 4257859e7156..98189c1bf2cb 100644 --- a/tests/neg-deep-subtype/html.scala +++ b/tests/warn/html.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + object HTML: type AttrArg = AppliedAttr | Seq[AppliedAttr] @@ -18,5 +18,3 @@ object HTML: } sb } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i10247.scala b/tests/warn/i10247.scala similarity index 84% rename from tests/neg/i10247.scala rename to tests/warn/i10247.scala index e98b2dc6e9c2..aa344362cac2 100644 --- a/tests/neg/i10247.scala +++ b/tests/warn/i10247.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation +//> using options -deprecation def usered = Color.Red // warn: value Red is deprecated @@ -25,5 +25,4 @@ enum Color { object Color { def useFoo2 = DeprecatedContainer.foo // warn // check that only enum cases are avoided -} -// 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/i10930.scala b/tests/warn/i10930.scala similarity index 72% rename from tests/neg/i10930.scala rename to tests/warn/i10930.scala index fe9009a52292..5d88235d0951 100644 --- a/tests/neg/i10930.scala +++ b/tests/warn/i10930.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import language.future @main def Test = @@ -12,5 +12,4 @@ import language.future case x: String => x.charAt(0) // warn case x: Array[t] => leafElem(x(1)) // warn case x: Iterable[t] => leafElem(x.head) // warn - case x: AnyVal => x // warn -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + case x: AnyVal => x // warn \ No newline at end of file diff --git a/tests/warn/i10994.scala b/tests/warn/i10994.scala new file mode 100644 index 000000000000..74fe3bba3778 --- /dev/null +++ b/tests/warn/i10994.scala @@ -0,0 +1,5 @@ + + +def foo = true match + case (b: Boolean): Boolean => () // warn + diff --git a/tests/neg/i11022.scala b/tests/warn/i11022.scala similarity index 71% rename from tests/neg/i11022.scala rename to tests/warn/i11022.scala index 475f65695251..8e2de9d8f519 100644 --- a/tests/neg/i11022.scala +++ b/tests/warn/i11022.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation +//> using options -deprecation @deprecated("no CaseClass") case class CaseClass(rgb: Int): @@ -10,5 +10,4 @@ object CaseClass: val a: CaseClass = CaseClass(42) // warn: deprecated type // warn: deprecated apply method val b: CaseClass = new CaseClass(42) // warn: deprecated type // warn: deprecated class val c: Unit = CaseClass(42).magic() // warn: deprecated apply method -val d: Unit = CaseClass.notDeprecated() // compiles -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +val d: Unit = CaseClass.notDeprecated() // compiles \ No newline at end of file diff --git a/tests/neg/i11097.scala b/tests/warn/i11097.scala similarity index 83% rename from tests/neg/i11097.scala rename to tests/warn/i11097.scala index b1f0b0bfd300..51c02a627a15 100644 --- a/tests/neg/i11097.scala +++ b/tests/warn/i11097.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + @main def test: Unit = { class C { type T1; type T2 } @@ -12,5 +12,4 @@ // ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String val x = pmatch(new C { type T1 = String; type T2 = String }) -} -// 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/i11225b.scala b/tests/warn/i11225b.scala similarity index 63% rename from tests/neg/i11225b.scala rename to tests/warn/i11225b.scala index b66cd3865f49..ad4e747fdc86 100644 --- a/tests/neg/i11225b.scala +++ b/tests/warn/i11225b.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation import compiletime.uninitialized @@ -11,4 +11,3 @@ class Memo[A](x: => A): cached = x cached -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i11333.scala b/tests/warn/i11333.scala similarity index 71% rename from tests/neg/i11333.scala rename to tests/warn/i11333.scala index 5149a99e7063..210916b30aaf 100644 --- a/tests/neg/i11333.scala +++ b/tests/warn/i11333.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class C: val f1: Float = 123456789 // warn @@ -11,5 +11,4 @@ class C: val f1_b: Float = i1 // warn val d1_b: Double = l1 // warn - val f2_b: Float = l2 // warn -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + val f2_b: Float = l2 // warn \ No newline at end of file diff --git a/tests/neg/i11344.scala b/tests/warn/i11344.scala similarity index 60% rename from tests/neg/i11344.scala rename to tests/warn/i11344.scala index 04c1b6f7f2d3..f8af81369162 100644 --- a/tests/neg/i11344.scala +++ b/tests/warn/i11344.scala @@ -1,10 +1,9 @@ -//> using options -Xfatal-warnings -deprecation +//> using options -deprecation trait Pet(val name: String, rest: Int): def f(suffix: String) = s"$name$suffix$rest" class Birdie(override val name: String) extends Pet("huh", 1) // warn -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/warn/i11963a.scala b/tests/warn/i11963a.scala new file mode 100644 index 000000000000..b6743d92a4ac --- /dev/null +++ b/tests/warn/i11963a.scala @@ -0,0 +1,4 @@ + + +open trait Foo // warn + diff --git a/tests/warn/i11963b.scala b/tests/warn/i11963b.scala new file mode 100644 index 000000000000..5868e6979214 --- /dev/null +++ b/tests/warn/i11963b.scala @@ -0,0 +1,4 @@ + + +open abstract class Foo // warn + diff --git a/tests/warn/i11963c.scala b/tests/warn/i11963c.scala new file mode 100644 index 000000000000..245b436ee1e9 --- /dev/null +++ b/tests/warn/i11963c.scala @@ -0,0 +1,8 @@ + + +object Test { + def foo: Any = { + open class Bar // warn + new Bar + } +} diff --git a/tests/neg/i12253.scala b/tests/warn/i12253.scala similarity index 91% rename from tests/neg/i12253.scala rename to tests/warn/i12253.scala index 51677c10b5f0..313ef4584098 100644 --- a/tests/neg/i12253.scala +++ b/tests/warn/i12253.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.quoted.{given, *} import deriving.*, compiletime.* @@ -27,5 +27,3 @@ object MacroUtils: end Extractors end MacroUtils - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i12597.scala b/tests/warn/i12597.scala similarity index 54% rename from tests/neg/i12597.scala rename to tests/warn/i12597.scala index 241e1b09e2a9..57546a69b173 100644 --- a/tests/neg/i12597.scala +++ b/tests/warn/i12597.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation +//> using options -deprecation @main def Test = val a: IArray[Int] = IArray(2) @@ -6,4 +6,3 @@ val c = b.toArray // warn: deprecated c(0) = "" -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i13011.scala b/tests/warn/i13011.scala similarity index 86% rename from tests/neg/i13011.scala rename to tests/warn/i13011.scala index fca3fcf7dded..0675ec936d0c 100644 --- a/tests/neg/i13011.scala +++ b/tests/warn/i13011.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class i13011 { lazy implicit val simple1: String = simple1 // warn @@ -20,5 +20,4 @@ class i13011 { } lazy val simple7: Function0[Any] = () => this.simple7 // Ok -} -// 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/i13440.scala b/tests/warn/i13440.scala similarity index 57% rename from tests/neg/i13440.scala rename to tests/warn/i13440.scala index 6b8bf99e08d3..4f1337391d61 100644 --- a/tests/neg/i13440.scala +++ b/tests/warn/i13440.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import language.`3.0-migration` @@ -6,5 +6,4 @@ def given = 42 // warn case class C(enum: List[Int] = Nil) { // warn val s = s"$enum" // 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/i13542.scala b/tests/warn/i13542.scala similarity index 89% rename from tests/neg/i13542.scala rename to tests/warn/i13542.scala index 404ddc0af2e5..f573aafadc7a 100644 --- a/tests/neg/i13542.scala +++ b/tests/warn/i13542.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.language.implicitConversions @@ -44,5 +44,4 @@ val x6 = implicit def barToFoo4(bar: Bar): Foo = lazy val y = bar.toFoo if false then y else ??? - val foo: Foo = Bar(1) -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + val foo: Foo = Bar(1) \ No newline at end of file diff --git a/tests/warn/i14705.scala b/tests/warn/i14705.scala new file mode 100644 index 000000000000..a6c56ed8b927 --- /dev/null +++ b/tests/warn/i14705.scala @@ -0,0 +1,6 @@ + + +val n = Nil +val b = n.head.isInstanceOf[String] // warn + + diff --git a/tests/neg/i14721.scala b/tests/warn/i14721.scala similarity index 65% rename from tests/neg/i14721.scala rename to tests/warn/i14721.scala index 46b9c4bb5b2a..9739bab5801b 100644 --- a/tests/neg/i14721.scala +++ b/tests/warn/i14721.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class C: def op: Unit = println("op") @@ -8,4 +8,3 @@ class C: catch case _: NullPointerException => handler // warn -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i15474.scala b/tests/warn/i15474.scala similarity index 81% rename from tests/neg/i15474.scala rename to tests/warn/i15474.scala index ff4fd7b641ef..20c203fe6e27 100644 --- a/tests/neg/i15474.scala +++ b/tests/warn/i15474.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.language.implicitConversions @@ -15,5 +15,4 @@ object Prices { object Price{ given Ordering[Price] = summon[Ordering[BigDecimal]] // 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/i15479.scala b/tests/warn/i15479.scala similarity index 69% rename from tests/neg/i15479.scala rename to tests/warn/i15479.scala index 0da30ab749e2..b69296ae23e4 100644 --- a/tests/neg/i15479.scala +++ b/tests/warn/i15479.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation package deptest { @deprecated("Not used any more", since="7") @@ -16,5 +16,3 @@ package depuser { } } } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503a.scala b/tests/warn/i15503a.scala similarity index 97% rename from tests/neg/i15503a.scala rename to tests/warn/i15503a.scala index b4655a37db33..df8691c21a13 100644 --- a/tests/neg/i15503a.scala +++ b/tests/warn/i15503a.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:imports +//> using options -Wunused:imports object FooUnused: @@ -265,5 +265,4 @@ package foo.test.typeapply.hklamdba.i16680: import foo.IO // OK def f[F[_]]: String = "hello" - def go = f[IO] -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + def go = f[IO] \ No newline at end of file diff --git a/tests/neg/i15503b.scala b/tests/warn/i15503b.scala similarity index 94% rename from tests/neg/i15503b.scala rename to tests/warn/i15503b.scala index f828812dfe5b..7ab86026ff00 100644 --- a/tests/neg/i15503b.scala +++ b/tests/warn/i15503b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:locals +//> using options -Wunused:locals val a = 1 // OK @@ -141,5 +141,4 @@ package test.foo.twisted.i16682: } isInt - def f = myPackage("42") -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + def f = myPackage("42") \ No newline at end of file diff --git a/tests/neg/i15503c.scala b/tests/warn/i15503c.scala similarity index 90% rename from tests/neg/i15503c.scala rename to tests/warn/i15503c.scala index 6475302e2f1d..7ca7fecd1f8d 100644 --- a/tests/neg/i15503c.scala +++ b/tests/warn/i15503c.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:privates +//> using options -Wunused:privates trait C class A: self: C => // OK @@ -54,5 +54,4 @@ package test.foo.i16682: case _ => println("NaN") } - def f = myPackage.isInt("42") -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + def f = myPackage.isInt("42") \ No newline at end of file diff --git a/tests/neg/i15503d.scala b/tests/warn/i15503d.scala similarity index 83% rename from tests/neg/i15503d.scala rename to tests/warn/i15503d.scala index 82e94e60ba75..5cda54fc5c42 100644 --- a/tests/neg/i15503d.scala +++ b/tests/warn/i15503d.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:unsafe-warn-patvars +//> using options -Wunused:unsafe-warn-patvars // todo : change to :patvars sealed trait Calc @@ -27,5 +27,4 @@ val a = Sum(S(S(Z)),Z) match { // todo : This should *NOT* pass in the future // val c = for { // case Some(x) <- Option(Option(1)) -// } println(s"hello world") -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +// } println(s"hello world") \ No newline at end of file diff --git a/tests/neg/i15503e.scala b/tests/warn/i15503e.scala similarity index 92% rename from tests/neg/i15503e.scala rename to tests/warn/i15503e.scala index 84c5066dff57..46d73a4945cd 100644 --- a/tests/neg/i15503e.scala +++ b/tests/warn/i15503e.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:explicits +//> using options -Wunused:explicits object Foo { /* This goes around the "trivial method" detection */ @@ -67,5 +67,4 @@ package foo.test.i16865: def fn(a: Int, b: Int): Int = b + 3 // OK object Ex2 extends Bar: - override def fn(a: Int, b: Int): Int = b + 3 // OK -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + override def fn(a: Int, b: Int): Int = b + 3 // OK \ No newline at end of file diff --git a/tests/neg/i15503f.scala b/tests/warn/i15503f.scala similarity index 79% rename from tests/neg/i15503f.scala rename to tests/warn/i15503f.scala index bea7cdf2a408..ccf0b7e74065 100644 --- a/tests/neg/i15503f.scala +++ b/tests/warn/i15503f.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:implicits +//> using options -Wunused:implicits /* This goes around the "trivial method" detection */ val default_int = 1 @@ -12,5 +12,3 @@ object Xd { private def f7(a: Int)(using Int) = summon[Int] + a // OK private def f8(a: Int)(using foo: Int) = a // warn } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i15503g.scala b/tests/warn/i15503g.scala similarity index 85% rename from tests/neg/i15503g.scala rename to tests/warn/i15503g.scala index 2f74c48cdbcc..fbd9f3c1352c 100644 --- a/tests/neg/i15503g.scala +++ b/tests/warn/i15503g.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:params +//> using options -Wunused:params /* This goes around the "trivial method" detection */ object Foo { @@ -20,5 +20,4 @@ package foo.test.i17101: extension[A] (x: Test[A]) { // OK def value: A = x def causesIssue: Unit = println("oh no") - } -// 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/i15503h.scala b/tests/warn/i15503h.scala similarity index 74% rename from tests/neg/i15503h.scala rename to tests/warn/i15503h.scala index a384df26b5f9..854693981488 100644 --- a/tests/neg/i15503h.scala +++ b/tests/warn/i15503h.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:linted +//> using options -Wunused:linted import collection.mutable.Set // warn @@ -17,5 +17,4 @@ class A { def g(x: Int): Int = x match case x:1 => 0 // OK case _ => 1 -} -// 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/i15503j.scala b/tests/warn/i15503j.scala similarity index 88% rename from tests/neg/i15503j.scala rename to tests/warn/i15503j.scala index 2d40b5b49d24..f5e15bb79f79 100644 --- a/tests/neg/i15503j.scala +++ b/tests/warn/i15503j.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:strict-no-implicit-warn +//> using options -Wunused:strict-no-implicit-warn package foo.unused.strict.test: package a: @@ -56,5 +56,4 @@ package foo.unused.summon.inlines: new {} val b: B = summon[B] - val c: C = summon[C] -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + val c: C = summon[C] \ No newline at end of file diff --git a/tests/neg/i15662.scala b/tests/warn/i15662.scala similarity index 78% rename from tests/neg/i15662.scala rename to tests/warn/i15662.scala index 366661c7bae4..72962e67a251 100644 --- a/tests/neg/i15662.scala +++ b/tests/warn/i15662.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + case class Composite[T](v: T) @@ -14,5 +14,3 @@ def m2(composite: Composite[_]): Unit = @main def Test = m(Composite("This is String")) - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i16639a.scala b/tests/warn/i16639a.scala similarity index 97% rename from tests/neg/i16639a.scala rename to tests/warn/i16639a.scala index 907fed7f0765..71812e23f636 100644 --- a/tests/neg/i16639a.scala +++ b/tests/warn/i16639a.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:all +//> using options -Wunused:all // class Bippy(a: Int, b: Int) { private def this(c: Int) = this(c, c) // warn /Dotty:NoWarn @@ -203,5 +203,4 @@ trait `short comings` { val x = 42 // warn /Dotty only triggers in dotty 17 } -} -// 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/i16649-refutable.scala b/tests/warn/i16649-refutable.scala similarity index 63% rename from tests/neg/i16649-refutable.scala rename to tests/warn/i16649-refutable.scala index 62336caf87df..5ff18b5a3633 100644 --- a/tests/neg/i16649-refutable.scala +++ b/tests/warn/i16649-refutable.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import quoted.* @@ -8,4 +8,3 @@ def foo(using Quotes)(x: Expr[Int]) = val '{ $b: Any } = x val '{ $c } = x -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i16728.scala b/tests/warn/i16728.scala similarity index 85% rename from tests/neg/i16728.scala rename to tests/warn/i16728.scala index 8d00b4fbea3b..4d28b07c51a3 100644 --- a/tests/neg/i16728.scala +++ b/tests/warn/i16728.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class A[T] { class X { @@ -32,5 +32,3 @@ object Test { } } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i16930.scala b/tests/warn/i16930.scala similarity index 79% rename from tests/neg/i16930.scala rename to tests/warn/i16930.scala index 6028b939813a..bf30fccbf601 100644 --- a/tests/neg/i16930.scala +++ b/tests/warn/i16930.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:imports +//> using options -Wunused:imports trait Outer: trait Used @@ -19,5 +19,4 @@ object Test1 { val outer1: Outer1 = ??? import outer1.{Unused1, UnusedToo1} // warn // warn def foo() = outer1.unusedToo1 // in this case UnusedToo1 is not used explicitly, only inferred -} -// 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/i17314b.scala b/tests/warn/i17314b.scala similarity index 65% rename from tests/neg/i17314b.scala rename to tests/warn/i17314b.scala index be7fda4682f7..e1500028ca93 100644 --- a/tests/neg/i17314b.scala +++ b/tests/warn/i17314b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:all +//> using options -Wunused:all package foo: class Foo[T] @@ -13,4 +13,3 @@ package bar: val repro: Foo[Int] = summon[Foo[Int]] -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i17612a.scala b/tests/warn/i17612a.scala similarity index 91% rename from tests/neg/i17612a.scala rename to tests/warn/i17612a.scala index 5aba92b095f3..2ae9bd75ccea 100644 --- a/tests/neg/i17612a.scala +++ b/tests/warn/i17612a.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Xlint:private-shadow +//> using options -Xlint:private-shadow object i17612a: class Base(var x: Int, val y: Int, var z: Int): @@ -39,5 +39,4 @@ object i17612a: derived.increment() println(derived.toString) // still x: '1', probably unexpected, for y it never prints the super value, less surprising println(derived.shadowed2) - println(derived.shadowed3) -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + println(derived.shadowed3) \ No newline at end of file diff --git a/tests/neg/i17613a.scala b/tests/warn/i17613a.scala similarity index 84% rename from tests/neg/i17613a.scala rename to tests/warn/i17613a.scala index e161c5908297..6ee55a5cf973 100644 --- a/tests/neg/i17613a.scala +++ b/tests/warn/i17613a.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Xlint:type-parameter-shadow +//> using options -Xlint:type-parameter-shadow object i17613a: class B: @@ -20,5 +20,4 @@ object i17613a: class F[A, M[N[A]]] type G[A, M[L[A]]] = Int def bar[A, N[M[L[A]]]] = ??? - def main(args: Array[String]) = println("Test for type parameter shadow") -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + def main(args: Array[String]) = println("Test for type parameter shadow") \ No newline at end of file diff --git a/tests/neg/i2333.scala b/tests/warn/i2333.scala similarity index 60% rename from tests/neg/i2333.scala rename to tests/warn/i2333.scala index 5cbf8fcd40cb..1ac5eb314325 100644 --- a/tests/neg/i2333.scala +++ b/tests/warn/i2333.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation +//> using options -deprecation @deprecated("bla", "2.11.0") class Foo { println("") @@ -8,5 +8,4 @@ object Test { new Foo // warn: deprecated new Foo(1) // warn: deprecated -} -// 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/i2673.scala b/tests/warn/i2673.scala new file mode 100644 index 000000000000..a04e3b370d56 --- /dev/null +++ b/tests/warn/i2673.scala @@ -0,0 +1,6 @@ + + +package Foos + +class Foo // warn +class foo diff --git a/tests/warn/i2673b.scala b/tests/warn/i2673b.scala new file mode 100644 index 000000000000..0d11317cd9e6 --- /dev/null +++ b/tests/warn/i2673b.scala @@ -0,0 +1,7 @@ + + +package Foos + +class Bar // warn +object bar + diff --git a/tests/warn/i2673c.scala b/tests/warn/i2673c.scala new file mode 100644 index 000000000000..682e4adfa2c9 --- /dev/null +++ b/tests/warn/i2673c.scala @@ -0,0 +1,9 @@ + + +package Foos + +object Outer { + case class X() // warn + object x +} + diff --git a/tests/warn/i3324.scala b/tests/warn/i3324.scala new file mode 100644 index 000000000000..ab0c24da39a5 --- /dev/null +++ b/tests/warn/i3324.scala @@ -0,0 +1,6 @@ + + +class Foo { + def foo(x: Any): Boolean = + x.isInstanceOf[List[String]] // warn +} diff --git a/tests/neg/i3561.scala b/tests/warn/i3561.scala similarity index 80% rename from tests/neg/i3561.scala rename to tests/warn/i3561.scala index 0a19e01e8ab6..a64a599eafec 100644 --- a/tests/neg/i3561.scala +++ b/tests/warn/i3561.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class Test { val Constant = 'Q' // OK if final @@ -15,5 +15,4 @@ class Test { case '5' | Constant => 3 case '4' => 4 } -} -// 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/i4008.scala b/tests/warn/i4008.scala similarity index 93% rename from tests/neg/i4008.scala rename to tests/warn/i4008.scala index fb24c25fc4ff..489a067bf6fd 100644 --- a/tests/neg/i4008.scala +++ b/tests/warn/i4008.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + // ===== Template annotations ===== @@ -47,5 +47,4 @@ class C[A](using @annotation.implicitNotFound("No C[${B}] found") c: Class[A]) / def someMethod1[A](using @annotation.implicitNotFound("No C[${B}] found") sc: C[A]) = 0 // warn -def someMethod2[A](using @annotation.implicitNotFound("No C[${A}] found") sc: C[A]) = "" -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +def someMethod2[A](using @annotation.implicitNotFound("No C[${A}] found") sc: C[A]) = "" \ No newline at end of file diff --git a/tests/neg-deep-subtype/i4297.scala b/tests/warn/i4297.scala similarity index 88% rename from tests/neg-deep-subtype/i4297.scala rename to tests/warn/i4297.scala index 3fcb427c246e..3268b8a2c7f5 100644 --- a/tests/neg-deep-subtype/i4297.scala +++ b/tests/warn/i4297.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class Test { def test[X <: Option[Int]](x: X) = x.isInstanceOf[Some[Int]] @@ -10,5 +10,4 @@ class Test { def test5[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[Int, Unit]] // warn def test6[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[Int, Any]] // warn def test7[Y <: Int, X <: Function1[Y, Unit]](x: X) = x.isInstanceOf[Function1[_, Unit]] -} -// 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/i4364.scala b/tests/warn/i4364.scala similarity index 75% rename from tests/neg/i4364.scala rename to tests/warn/i4364.scala index 225fd1dd0384..5cfc2ed5076d 100644 --- a/tests/neg/i4364.scala +++ b/tests/warn/i4364.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + object Test { def foo(c: java.util.function.Consumer[Integer]) = c.accept(0) @@ -9,5 +9,3 @@ object Test { new java.io.ObjectOutputStream(f) // warn: OutputStream is not @FunctionalInterface } } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/warn/i4936b.scala b/tests/warn/i4936b.scala new file mode 100644 index 000000000000..057c90545dbd --- /dev/null +++ b/tests/warn/i4936b.scala @@ -0,0 +1,3 @@ + + +final object Foo // warn diff --git a/tests/neg/i4986b.scala b/tests/warn/i4986b.scala similarity index 89% rename from tests/neg/i4986b.scala rename to tests/warn/i4986b.scala index 9df1eea64e28..6f2a0885090b 100644 --- a/tests/neg/i4986b.scala +++ b/tests/warn/i4986b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.annotation.implicitNotFound @@ -19,5 +19,4 @@ trait U[X, Y[_], Z[_, ZZ]] { class I[R] { def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // warn // warn // 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/i5013.scala b/tests/warn/i5013.scala similarity index 73% rename from tests/neg/i5013.scala rename to tests/warn/i5013.scala index 1950770e8204..9fbc32967b78 100644 --- a/tests/neg/i5013.scala +++ b/tests/warn/i5013.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class Foo { @@ -8,5 +8,4 @@ class Foo { 3 // warn: A pure expression does nothing in statement position 4 // warn: A pure expression does nothing in statement position } -} -// 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/i5013b.scala b/tests/warn/i5013b.scala similarity index 75% rename from tests/neg/i5013b.scala rename to tests/warn/i5013b.scala index 6321538ffef2..09ce319e0a88 100644 --- a/tests/neg/i5013b.scala +++ b/tests/warn/i5013b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class Foo { @@ -17,4 +17,3 @@ class Foo { } -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/warn/i6190b.scala b/tests/warn/i6190b.scala new file mode 100644 index 000000000000..a10006516c6f --- /dev/null +++ b/tests/warn/i6190b.scala @@ -0,0 +1,6 @@ + + +case class Rule(name: String) + +def foo = List("1", "2").map(Rule) // warn + diff --git a/tests/neg/i7314.scala b/tests/warn/i7314.scala similarity index 69% rename from tests/neg/i7314.scala rename to tests/warn/i7314.scala index 541e18c25761..4d0d525542bf 100644 --- a/tests/neg/i7314.scala +++ b/tests/warn/i7314.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -source future +//> using options -source future @main def Test = // conversion out of the opaque type: @@ -9,5 +9,3 @@ a(0) = 0 } println(imm1(0)) // 0 - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i7821.scala b/tests/warn/i7821.scala similarity index 83% rename from tests/neg/i7821.scala rename to tests/warn/i7821.scala index 6604af7604c1..6ac46ef730bb 100644 --- a/tests/neg/i7821.scala +++ b/tests/warn/i7821.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + object XObject { opaque type X = Int @@ -24,4 +24,3 @@ object Main extends App { println(XObject.anX + XObject.anX) // prints 10 println(MyXObject.anX + MyXObject.anX) // infinite loop } -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i7821b.scala b/tests/warn/i7821b.scala similarity index 80% rename from tests/neg/i7821b.scala rename to tests/warn/i7821b.scala index 93598b968adf..db3de3f86e2f 100644 --- a/tests/neg/i7821b.scala +++ b/tests/warn/i7821b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + object Test { @@ -10,5 +10,4 @@ object Test { { def f(x: Int, y: Int): Int = { val a = 3; f(a, 1) } } // warn { def f(x: Int): Int = f(1) } // 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/i8427.scala b/tests/warn/i8427.scala similarity index 60% rename from tests/neg/i8427.scala rename to tests/warn/i8427.scala index 7c22184aeb03..61ea2eabb79a 100644 --- a/tests/neg/i8427.scala +++ b/tests/warn/i8427.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + @SerialVersionUID(1L) // warn trait T @@ -7,4 +7,3 @@ object Test { var t: T = compiletime.uninitialized def main(args: Array[String]) = println("hi") } -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i8781b.scala b/tests/warn/i8781b.scala similarity index 54% rename from tests/neg/i8781b.scala rename to tests/warn/i8781b.scala index 01cd7ef69096..455cd49b927a 100644 --- a/tests/neg/i8781b.scala +++ b/tests/warn/i8781b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + object Test: @@ -6,4 +6,3 @@ object Test: println(3.isInstanceOf[Boolean]) // warn -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i8922b.scala b/tests/warn/i8922b.scala similarity index 97% rename from tests/neg/i8922b.scala rename to tests/warn/i8922b.scala index c199f5be5bd4..f167eea005c5 100644 --- a/tests/neg/i8922b.scala +++ b/tests/warn/i8922b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + case class Token(tokenType: TokenType, lexeme: StringV, line: IntV) @@ -76,5 +76,3 @@ object Interpreter { } } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i9166.scala b/tests/warn/i9166.scala similarity index 53% rename from tests/neg/i9166.scala rename to tests/warn/i9166.scala index bfb30937fb21..34a42987f6aa 100644 --- a/tests/neg/i9166.scala +++ b/tests/warn/i9166.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wimplausible-patterns +//> using options -Wimplausible-patterns object UnitTest extends App { def foo(m: Unit) = m match { case runtime.BoxedUnit.UNIT => println("ok") // warn @@ -6,4 +6,3 @@ object UnitTest extends App { foo(()) } -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i9241.scala b/tests/warn/i9241.scala similarity index 90% rename from tests/neg/i9241.scala rename to tests/warn/i9241.scala index a169ce709b5f..ed1db2df0c8e 100644 --- a/tests/neg/i9241.scala +++ b/tests/warn/i9241.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class Foo { def unary_~() : Foo = this // warn @@ -40,5 +40,4 @@ extension (using Int)(x: Byte) def unary_+[U] : Int = ??? def unary_!() : Int = ??? // warn def unary_~(using Int) : Int = ??? -end extension -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +end extension \ No newline at end of file diff --git a/tests/warn/i9266.scala b/tests/warn/i9266.scala new file mode 100644 index 000000000000..c621e9e20b99 --- /dev/null +++ b/tests/warn/i9266.scala @@ -0,0 +1,6 @@ + + +import language.`future-migration` + +def test = { implicit x: Int => x + x } // warn + diff --git a/tests/neg/i9408a.scala b/tests/warn/i9408a.scala similarity index 94% rename from tests/neg/i9408a.scala rename to tests/warn/i9408a.scala index d3544ec20be5..64b58ff59550 100644 --- a/tests/neg/i9408a.scala +++ b/tests/warn/i9408a.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import language.`3.0-migration` import scala.language.implicitConversions @@ -85,5 +85,4 @@ object Test15 { implicit def implicitSeq[A]: Seq[A] = ??? def foo(implicit ev: Seq[Int]): Unit = ??? foo -} -// 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/i9740.scala b/tests/warn/i9740.scala similarity index 81% rename from tests/neg/i9740.scala rename to tests/warn/i9740.scala index 8e5f56eaab0d..fc330df4d6a9 100644 --- a/tests/neg/i9740.scala +++ b/tests/warn/i9740.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wimplausible-patterns +//> using options -Wimplausible-patterns abstract class RecoveryCompleted object RecoveryCompleted extends RecoveryCompleted @@ -14,5 +14,4 @@ class Test { def foo(x: TypedRecoveryCompleted) = x match case RecoveryCompleted => // warn case TypedRecoveryCompleted => -} -// 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/i9740b.scala b/tests/warn/i9740b.scala similarity index 79% rename from tests/neg/i9740b.scala rename to tests/warn/i9740b.scala index 3f3f9a85222c..632308e3322d 100644 --- a/tests/neg/i9740b.scala +++ b/tests/warn/i9740b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wimplausible-patterns +//> using options -Wimplausible-patterns enum Recovery: case RecoveryCompleted @@ -17,5 +17,4 @@ class Test { def foo(x: TypedRecovery) = x match case RecoveryCompleted => // warn case TypedRecoveryCompleted => -} -// 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/i9740c.scala b/tests/warn/i9740c.scala similarity index 76% rename from tests/neg/i9740c.scala rename to tests/warn/i9740c.scala index b250ac907454..8ddf87adf46b 100644 --- a/tests/neg/i9740c.scala +++ b/tests/warn/i9740c.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wimplausible-patterns +//> using options -Wimplausible-patterns sealed trait Exp[T] case class IntExp(x: Int) extends Exp[Int] case class StrExp(x: String) extends Exp[String] @@ -16,4 +16,3 @@ class Foo { case Obj(o) => } -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/i9740d.scala b/tests/warn/i9740d.scala similarity index 71% rename from tests/neg/i9740d.scala rename to tests/warn/i9740d.scala index ee0df4ea7cf7..118ee20582dd 100644 --- a/tests/neg/i9740d.scala +++ b/tests/warn/i9740d.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wimplausible-patterns +//> using options -Wimplausible-patterns sealed trait Exp[T] case class IntExp(x: Int) extends Exp[Int] @@ -11,4 +11,3 @@ class Foo[U <: Int, T <: U] { case StrExp(x) => case UnitExp => // warn } -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/warn/i9751.scala b/tests/warn/i9751.scala new file mode 100644 index 000000000000..284070723474 --- /dev/null +++ b/tests/warn/i9751.scala @@ -0,0 +1,11 @@ + + +def f(): Unit = { + () // warn + () +} + +inline def g(): Unit = { + () // warn + () +} \ No newline at end of file diff --git a/tests/neg/i9776.scala b/tests/warn/i9776.scala similarity index 93% rename from tests/neg/i9776.scala rename to tests/warn/i9776.scala index d0f512454a31..93b7cce98fef 100644 --- a/tests/neg/i9776.scala +++ b/tests/warn/i9776.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.annotation.switch @@ -58,5 +58,4 @@ object TaggedFruit { case 2 => true case Apple.tag => true } -} -// 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/i9880.scala b/tests/warn/i9880.scala similarity index 85% rename from tests/neg/i9880.scala rename to tests/warn/i9880.scala index 963711277faf..68775e7646a5 100644 --- a/tests/neg/i9880.scala +++ b/tests/warn/i9880.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + opaque type Bytes = Array[Byte] object Bytes: @@ -29,5 +29,4 @@ class Sym(val owner: Sym) extension (sym: Sym) def isSomething: Boolean = false def isFoo: Boolean = sym.isSomething && sym.owner.isFoo // was: Infinite loop in function body - def isBar: Boolean = sym.isSomething || sym.owner.isBar // was: Infinite loop in function body -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + def isBar: Boolean = sym.isSomething || sym.owner.isBar // was: Infinite loop in function body \ No newline at end of file diff --git a/tests/neg/implicit-conversions-old.scala b/tests/warn/implicit-conversions-old.scala similarity index 81% rename from tests/neg/implicit-conversions-old.scala rename to tests/warn/implicit-conversions-old.scala index c1267ae79064..24e1124015e3 100644 --- a/tests/neg/implicit-conversions-old.scala +++ b/tests/warn/implicit-conversions-old.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -feature +//> using options -feature class A class B @@ -22,5 +22,4 @@ object Test { val x1: A = new B val x2: B = new A // ok, since it's an old-style comversion val x3: C = new A // ok, since it's an old-style comversion -} -// 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/implicit-conversions.scala b/tests/warn/implicit-conversions.scala similarity index 81% rename from tests/neg/implicit-conversions.scala rename to tests/warn/implicit-conversions.scala index 154fc0689d98..946d0c96fd5a 100644 --- a/tests/neg/implicit-conversions.scala +++ b/tests/warn/implicit-conversions.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -feature +//> using options -feature class A class B @@ -28,5 +28,4 @@ object Test { val x1: A = new B // warn under -Xfatal-warnings -feature val x2: B = new A // warn under -Xfatal-warnings -feature val x3: C = new A // warn under -Xfatal-warnings -feature -} -// 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/infix.scala b/tests/warn/infix.scala similarity index 92% rename from tests/neg/infix.scala rename to tests/warn/infix.scala index 2be1e3091eed..6494df970e3f 100644 --- a/tests/neg/infix.scala +++ b/tests/warn/infix.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation // Compile with -strict -Xfatal-warnings -deprecation class C: @@ -67,5 +67,4 @@ def test() = { val _ Q _ = q // OK -} -// 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/inline-givens.scala b/tests/warn/inline-givens.scala similarity index 67% rename from tests/neg/inline-givens.scala rename to tests/warn/inline-givens.scala index d8b9d1f2692c..5ab4fd65fdc9 100644 --- a/tests/neg/inline-givens.scala +++ b/tests/warn/inline-givens.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class Item(x: String) @@ -12,5 +12,4 @@ inline given c: Conversion[String, Item] = { x => Item(x) } // warn inline given d: Conversion[String, Item] with - def apply(x: String) = Item(x) // ok -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + def apply(x: String) = Item(x) // ok \ No newline at end of file diff --git a/tests/neg/main-functions-nameclash.scala b/tests/warn/main-functions-nameclash.scala similarity index 56% rename from tests/neg/main-functions-nameclash.scala rename to tests/warn/main-functions-nameclash.scala index e72f3d2eb0a4..bc0fe64379d4 100644 --- a/tests/neg/main-functions-nameclash.scala +++ b/tests/warn/main-functions-nameclash.scala @@ -1,7 +1,5 @@ -//> using options -Xfatal-warnings + object foo { @main def foo(x: Int) = () // warn: class foo and object foo produce classes that overwrite one another } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/warn/manifest-summoning-b.scala b/tests/warn/manifest-summoning-b.scala new file mode 100644 index 000000000000..18ddec1250b5 --- /dev/null +++ b/tests/warn/manifest-summoning-b.scala @@ -0,0 +1,4 @@ +//> using options -deprecation + +val foo = manifest[List[? <: Int]] // warn +val bar = optManifest[Array[? <: String]] // warn \ No newline at end of file diff --git a/tests/neg/matchable.scala b/tests/warn/matchable.scala similarity index 84% rename from tests/neg/matchable.scala rename to tests/warn/matchable.scala index 6d8b41f87e55..8adcdcf1c90a 100644 --- a/tests/neg/matchable.scala +++ b/tests/warn/matchable.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -source future +//> using options -source future def foo[T](x: T): Matchable = println(x.getClass()) // ok @@ -25,5 +25,4 @@ def foo[T](x: T): Matchable = @main def Test = val x: Matchable = foo(1) val y: Matchable = foo("hello") - assert(x != y) -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + assert(x != y) \ No newline at end of file diff --git a/tests/neg/newline-braces.scala b/tests/warn/newline-braces.scala similarity index 55% rename from tests/neg/newline-braces.scala rename to tests/warn/newline-braces.scala index 2aea81c229b2..9ec2961ee30d 100644 --- a/tests/neg/newline-braces.scala +++ b/tests/warn/newline-braces.scala @@ -1,4 +1,4 @@ -//> using options -source 3.0-migration -Xfatal-warnings +//> using options -source 3.0-migration def f: List[Int] = { List(1, 2, 3).map // no newline inserted here in Scala-2 compat mode @@ -7,4 +7,3 @@ def f: List[Int] = { } } -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/nonunit-statement.scala b/tests/warn/nonunit-statement.scala similarity index 97% rename from tests/neg/nonunit-statement.scala rename to tests/warn/nonunit-statement.scala index b96d6b5cfa59..297a1063cb4d 100644 --- a/tests/neg/nonunit-statement.scala +++ b/tests/warn/nonunit-statement.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wnonunit-statement -Wvalue-discard +//> using options -Wnonunit-statement -Wvalue-discard import collection.ArrayOps import collection.mutable.{ArrayBuilder, LinkedHashSet, ListBuffer} import concurrent._ @@ -195,5 +195,4 @@ class Depends { f(d) () } -} -// 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/old-syntax.scala b/tests/warn/old-syntax.scala new file mode 100644 index 000000000000..d584e3692a0a --- /dev/null +++ b/tests/warn/old-syntax.scala @@ -0,0 +1,5 @@ +//> using options -deprecation + +val f = (x: Int) ⇒ x + 1 // warn + +val list = for (n ← List(42)) yield n + 1 // warn \ No newline at end of file diff --git a/tests/neg/opaque-match.scala b/tests/warn/opaque-match.scala similarity index 75% rename from tests/neg/opaque-match.scala rename to tests/warn/opaque-match.scala index 88c8104506ae..453d525bac2c 100644 --- a/tests/neg/opaque-match.scala +++ b/tests/warn/opaque-match.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + case class C() @@ -21,5 +21,4 @@ def Test[T] = (??? : Any) match case _: List[O.T @unchecked] => ??? // OK (??? : Any) match - case _: List[T] => ??? // warn -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + case _: List[T] => ??? // warn \ No newline at end of file diff --git a/tests/neg-deep-subtype/or-type-trees.scala b/tests/warn/or-type-trees.scala similarity index 90% rename from tests/neg-deep-subtype/or-type-trees.scala rename to tests/warn/or-type-trees.scala index 4e74df3cea4e..ed6e4d01b9ff 100644 --- a/tests/neg-deep-subtype/or-type-trees.scala +++ b/tests/warn/or-type-trees.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + object Test1 { trait Tree @@ -37,5 +37,4 @@ object Test2 { myTree match case treeFn: (_ => _) => // ok case _ => -} -// 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/ovlazy.scala b/tests/warn/ovlazy.scala new file mode 100644 index 000000000000..1dfa284a00c9 --- /dev/null +++ b/tests/warn/ovlazy.scala @@ -0,0 +1,9 @@ +//> using options -source 3.0-migration + +class A { + val x: Int = 1 +} +class B extends A { + override lazy val x: Int = 2 // warn +} + diff --git a/tests/neg/quote-simple-hole.scala b/tests/warn/quote-simple-hole.scala similarity index 77% rename from tests/neg/quote-simple-hole.scala rename to tests/warn/quote-simple-hole.scala index 88af780aa5cd..f23d2c0535c4 100644 --- a/tests/neg/quote-simple-hole.scala +++ b/tests/warn/quote-simple-hole.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.quoted.Quotes @@ -14,5 +14,4 @@ def test(using Quotes) = { } } } -} -// 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-deep-subtype/refined-types.scala b/tests/warn/refined-types.scala similarity index 90% rename from tests/neg-deep-subtype/refined-types.scala rename to tests/warn/refined-types.scala index 0e76ff58515f..1ef0f84c00d4 100644 --- a/tests/neg-deep-subtype/refined-types.scala +++ b/tests/warn/refined-types.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + class A class B extends A @@ -21,5 +21,4 @@ def bu(x: AA) = x.isInstanceOf[BU] // was: the type test for BU cannot be checke def al_ba(x: AL) = x.isInstanceOf[BA] // warn: the type test for BA cannot be checked at runtime def au_ba(x: AU) = x.isInstanceOf[BA] // warn: the type test for BA cannot be checked at runtime def al_bu(x: AL) = x.isInstanceOf[BU] // warn: the type test for BU cannot be checked at runtime -def au_bl(x: AU) = x.isInstanceOf[BL] // warn: the type test for BL cannot be checked at runtime -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file +def au_bl(x: AU) = x.isInstanceOf[BL] // warn: the type test for BL cannot be checked at runtime \ No newline at end of file diff --git a/tests/neg/refinements-this.scala b/tests/warn/refinements-this.scala similarity index 52% rename from tests/neg/refinements-this.scala rename to tests/warn/refinements-this.scala index 111ce84ffdc8..3e4c64cf1e59 100644 --- a/tests/neg/refinements-this.scala +++ b/tests/warn/refinements-this.scala @@ -1,7 +1,6 @@ -//> using options -Xfatal-warnings + class Outer: type X = { type O = Outer.this.type } // ok type Y = { type O = this.type } // warn -// nopos-error: No warnings can be incurred under -Werror. diff --git a/tests/neg/strict-pattern-bindings-3.2.scala b/tests/warn/strict-pattern-bindings-3.2.scala similarity index 90% rename from tests/neg/strict-pattern-bindings-3.2.scala rename to tests/warn/strict-pattern-bindings-3.2.scala index c678e2ebe93a..e4df8e770a01 100644 --- a/tests/neg/strict-pattern-bindings-3.2.scala +++ b/tests/warn/strict-pattern-bindings-3.2.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + // These tests should fail under -Xfatal-warnings with source version source version 3.2 or later import language.`3.2` @@ -34,5 +34,4 @@ object Test: object Triple { def unapply(t: (Int, Int, Int)): (Int, Int, Int) = t } val Positive(p) = 5 // warn - val Some(s1) = Option(1) // warn -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + val Some(s1) = Option(1) // warn \ No newline at end of file diff --git a/tests/neg/supertraits-b.scala b/tests/warn/supertraits-b.scala similarity index 84% rename from tests/neg/supertraits-b.scala rename to tests/warn/supertraits-b.scala index b56059b4abbb..b36fcb5634b7 100644 --- a/tests/neg/supertraits-b.scala +++ b/tests/warn/supertraits-b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + transparent sealed trait TA transparent sealed trait TB @@ -32,5 +32,4 @@ object Test: choose4(a, b) match case _: (TA & TB) => ??? - case _: Product => ??? // warn: unreachable -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file + case _: Product => ??? // warn: unreachable \ No newline at end of file diff --git a/tests/neg/switches.scala b/tests/warn/switches.scala similarity index 97% rename from tests/neg/switches.scala rename to tests/warn/switches.scala index f662a1f694ca..9b45e3ed0d51 100644 --- a/tests/neg/switches.scala +++ b/tests/warn/switches.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.annotation.switch @@ -99,5 +99,4 @@ object Main { case IntAnyVal(1000) => 3 case IntAnyVal(10000) => 4 } -} -// 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/symbolic-packages.scala b/tests/warn/symbolic-packages.scala similarity index 59% rename from tests/neg/symbolic-packages.scala rename to tests/warn/symbolic-packages.scala index 557fb06f68a9..6e0ef04da6bb 100644 --- a/tests/neg/symbolic-packages.scala +++ b/tests/warn/symbolic-packages.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + package `with spaces` { // warn class Foo @@ -10,5 +10,4 @@ package +.* { // warn // warn package object `mixed_*` { // warn class Baz -} -// 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-deep-subtype/t2755.scala b/tests/warn/t2755.scala similarity index 95% rename from tests/neg-deep-subtype/t2755.scala rename to tests/warn/t2755.scala index 698b59a57efd..89ebda4fb54d 100644 --- a/tests/neg-deep-subtype/t2755.scala +++ b/tests/warn/t2755.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + // Test cases: the only place we can cut and paste without crying // ourself to sleep. @@ -57,5 +57,4 @@ object Test { println(f3(Array(1L))) println(f3(null)) } -} -// 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/t3235-minimal.scala b/tests/warn/t3235-minimal.scala similarity index 74% rename from tests/neg/t3235-minimal.scala rename to tests/warn/t3235-minimal.scala index 27448da4b80b..22e6da9f31a0 100644 --- a/tests/neg/t3235-minimal.scala +++ b/tests/warn/t3235-minimal.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation +//> using options -deprecation object Test { def main(args: Array[String]): Unit = { @@ -7,5 +7,4 @@ object Test { assert(1234567890123456789L.round == 1234567890123456789L) // warn assert(math.round(1234567890123456789L) == 1234567890123456789L) // 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/t5830.scala b/tests/warn/t5830.scala similarity index 69% rename from tests/neg/t5830.scala rename to tests/warn/t5830.scala index dc6e51ed1f3d..41cdfb1059a7 100644 --- a/tests/neg/t5830.scala +++ b/tests/warn/t5830.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.annotation.switch @@ -9,5 +9,3 @@ class Test { case 'c' => } } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg-deep-subtype/type-lambda.scala b/tests/warn/type-lambda.scala similarity index 74% rename from tests/neg-deep-subtype/type-lambda.scala rename to tests/warn/type-lambda.scala index 9e1b1b408f7c..788647496a4f 100644 --- a/tests/neg-deep-subtype/type-lambda.scala +++ b/tests/warn/type-lambda.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + trait A[T] trait B[T] extends A[T] @@ -14,5 +14,3 @@ object Test { case _ => } } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/type-test-paths-2.scala b/tests/warn/type-test-paths-2.scala similarity index 91% rename from tests/neg/type-test-paths-2.scala rename to tests/warn/type-test-paths-2.scala index 5a68c1607bfd..79b22fa70049 100644 --- a/tests/neg/type-test-paths-2.scala +++ b/tests/warn/type-test-paths-2.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.reflect.TypeTest @@ -40,5 +40,4 @@ object Test { case n: r1.Idx => // warn: the type test for Test.r1.Idx cannot be checked at runtime case n: r1.Nat => // Ok } -} -// 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/type-test-paths.scala b/tests/warn/type-test-paths.scala similarity index 87% rename from tests/neg/type-test-paths.scala rename to tests/warn/type-test-paths.scala index e8c9d2879e6d..03501cfd5957 100644 --- a/tests/neg/type-test-paths.scala +++ b/tests/warn/type-test-paths.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.reflect.TypeTest @@ -37,5 +37,3 @@ object T1 extends T { } } - -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/type-test-syntesize-b.scala b/tests/warn/type-test-syntesize-b.scala similarity index 82% rename from tests/neg/type-test-syntesize-b.scala rename to tests/warn/type-test-syntesize-b.scala index ab3b970f79f8..f5a71c816ef1 100644 --- a/tests/neg/type-test-syntesize-b.scala +++ b/tests/warn/type-test-syntesize-b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + import scala.reflect.TypeTest @@ -28,5 +28,4 @@ object Test { class A { type X type Y <: X -} -// 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/xfatalWarnings.scala b/tests/warn/xfatalWarnings.scala similarity index 74% rename from tests/neg/xfatalWarnings.scala rename to tests/warn/xfatalWarnings.scala index 13763bf3b48d..7e77ac468370 100644 --- a/tests/neg/xfatalWarnings.scala +++ b/tests/warn/xfatalWarnings.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings + object xfatalWarnings { val opt:Option[String] = Some("test") @@ -13,4 +13,3 @@ object xfatalWarnings { } // When running with fatal warnings: -// nopos-error: No warnings can be incurred under -Werror. From 17b6e5adb9f01c5b82c63dca9c57e23dccc3b48b Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Fri, 3 Nov 2023 14:51:41 +0100 Subject: [PATCH 04/11] More tests moved to warn --- tests/neg/rewrite-messages.scala | 9 --------- tests/neg/with-type-operator-future-migration.scala | 7 ------- tests/{neg => warn}/15981.scala | 3 +-- tests/{neg => warn}/17284.scala | 5 ++--- tests/{neg => warn}/18493.scala | 5 ++--- tests/{neg => warn}/i15503i.scala | 5 ++--- tests/{neg => warn}/i15893.scala | 5 ++--- tests/{neg => warn}/i17266.scala | 5 ++--- tests/{neg => warn}/i18722.scala | 5 ++--- tests/{neg => warn}/i4812.scala | 5 ++--- tests/{neg => warn}/i5077.scala | 5 ++--- .../refutable-pattern-binding-messages.scala | 5 ++--- tests/warn/rewrite-messages.scala | 8 ++++++++ tests/{neg => warn}/warn-value-discard.scala | 5 ++--- tests/warn/with-type-operator-future-migration.scala | 6 ++++++ 15 files changed, 35 insertions(+), 48 deletions(-) delete mode 100644 tests/neg/rewrite-messages.scala delete mode 100644 tests/neg/with-type-operator-future-migration.scala rename tests/{neg => warn}/15981.scala (63%) rename tests/{neg => warn}/17284.scala (57%) rename tests/{neg => warn}/18493.scala (72%) rename tests/{neg => warn}/i15503i.scala (98%) rename tests/{neg => warn}/i15893.scala (95%) rename tests/{neg => warn}/i17266.scala (93%) rename tests/{neg => warn}/i18722.scala (55%) rename tests/{neg => warn}/i4812.scala (95%) rename tests/{neg => warn}/i5077.scala (89%) rename tests/{neg => warn}/refutable-pattern-binding-messages.scala (88%) create mode 100644 tests/warn/rewrite-messages.scala rename tests/{neg => warn}/warn-value-discard.scala (94%) create mode 100644 tests/warn/with-type-operator-future-migration.scala 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 + From c0185495d5c11ad457cce0536751cd5d08933f94 Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Wed, 8 Nov 2023 17:34:28 +0100 Subject: [PATCH 05/11] Fixing global-init WIP --- .../init-global/neg/context-sensitivity.check | 0 .../init-global/neg/context-sensitivity.scala | 2 ++ tests/init-global/neg/global-cycle1.check | 20 ------------------- tests/init-global/neg/global-cycle1.scala | 2 ++ tests/init-global/neg/global-cycle14.check | 0 tests/init-global/neg/global-cycle14.scala | 2 ++ tests/init-global/neg/global-cycle2.check | 0 tests/init-global/neg/global-cycle2.scala | 2 ++ tests/init-global/neg/global-cycle3.check | 0 tests/init-global/neg/global-cycle3.scala | 2 ++ tests/init-global/neg/global-cycle4.check | 0 tests/init-global/neg/global-cycle4.scala | 2 ++ tests/init-global/neg/global-cycle5.check | 0 tests/init-global/neg/global-cycle5.scala | 3 ++- tests/init-global/neg/global-cycle6.check | 0 tests/init-global/neg/global-cycle6.scala | 3 ++- tests/init-global/neg/global-cycle7.check | 0 tests/init-global/neg/global-cycle7.scala | 2 ++ tests/init-global/neg/global-cycle8.check | 0 tests/init-global/neg/global-cycle8.scala | 2 ++ .../init-global/neg/global-irrelevance1.check | 0 .../init-global/neg/global-irrelevance1.scala | 3 ++- .../init-global/neg/global-irrelevance2.check | 0 .../init-global/neg/global-irrelevance2.scala | 2 ++ .../init-global/neg/global-irrelevance3.check | 0 .../init-global/neg/global-irrelevance3.scala | 2 ++ .../init-global/neg/global-irrelevance4.check | 0 .../init-global/neg/global-irrelevance4.scala | 2 ++ .../init-global/neg/global-irrelevance5.check | 0 .../init-global/neg/global-irrelevance5.scala | 2 ++ .../init-global/neg/global-irrelevance6.check | 0 .../init-global/neg/global-irrelevance6.scala | 2 ++ .../init-global/neg/global-irrelevance7.check | 0 .../init-global/neg/global-irrelevance7.scala | 2 ++ tests/init-global/neg/global-list.check | 0 tests/init-global/neg/global-list.scala | 3 ++- tests/init-global/neg/global-local-var.check | 0 tests/init-global/neg/global-local-var.scala | 2 ++ tests/init-global/neg/global-region1.check | 0 tests/init-global/neg/global-region1.scala | 2 ++ tests/init-global/neg/i11262.check | 0 tests/init-global/neg/i11262.scala | 2 ++ tests/init-global/neg/i12544b.check | 0 tests/init-global/neg/i12544b.scala | 2 ++ tests/init-global/neg/i9176.check | 0 tests/init-global/neg/i9176.scala | 2 ++ tests/init-global/neg/line-spacing.check | 13 ------------ tests/init-global/neg/line-spacing.scala | 2 ++ tests/init-global/neg/mutable-array.check | 0 tests/init-global/neg/mutable-array.scala | 2 ++ tests/init-global/neg/mutable-read1.check | 0 tests/init-global/neg/mutable-read1.scala | 3 ++- tests/init-global/neg/mutable-read2.check | 0 tests/init-global/neg/mutable-read2.scala | 3 ++- tests/init-global/neg/mutable-read3.check | 0 tests/init-global/neg/mutable-read3.scala | 3 ++- tests/init-global/neg/mutable-read4.check | 0 tests/init-global/neg/mutable-read4.scala | 3 ++- tests/init-global/neg/mutable-read5.check | 0 tests/init-global/neg/mutable-read5.scala | 3 ++- tests/init-global/neg/mutable-read6.check | 0 tests/init-global/neg/mutable-read6.scala | 3 ++- tests/init-global/neg/mutable-read7.check | 0 tests/init-global/neg/mutable-read7.scala | 3 ++- tests/init-global/neg/mutable-read8.check | 0 tests/init-global/neg/mutable-read8.scala | 3 ++- tests/init-global/neg/partial-ordering.check | 0 tests/init-global/neg/partial-ordering.scala | 3 ++- tests/init-global/neg/patmat-unapplySeq.check | 11 ---------- tests/init-global/neg/patmat-unapplySeq.scala | 2 ++ .../init-global/neg/patmat-unapplySeq2.check | 0 .../init-global/neg/patmat-unapplySeq2.scala | 2 ++ tests/init-global/neg/patmat.check | 0 tests/init-global/neg/patmat.scala | 2 ++ tests/init-global/neg/return.check | 0 tests/init-global/neg/return.scala | 2 ++ tests/init-global/neg/return2.check | 0 tests/init-global/neg/return2.scala | 2 ++ tests/init-global/neg/t5366.check | 0 tests/init-global/neg/t5366.scala | 3 ++- tests/init-global/neg/t9115.check | 0 tests/init-global/neg/t9115.scala | 2 ++ tests/init-global/neg/t9261.check | 0 tests/init-global/neg/t9261.scala | 2 ++ tests/init-global/neg/t9312.check | 0 tests/init-global/neg/t9312.scala | 2 ++ tests/init-global/neg/t9360.check | 0 tests/init-global/neg/t9360.scala | 2 ++ .../neg/unapply-implicit-arg.check | 0 .../neg/unapply-implicit-arg.scala | 3 ++- .../neg/unapply-implicit-arg2.check | 0 .../neg/unapply-implicit-arg2.scala | 2 ++ .../neg/unapply-implicit-arg3.check | 0 .../neg/unapply-implicit-arg3.scala | 2 ++ .../neg/unapplySeq-implicit-arg.check | 0 .../neg/unapplySeq-implicit-arg.scala | 2 ++ .../neg/unapplySeq-implicit-arg2.check | 0 .../neg/unapplySeq-implicit-arg2.scala | 2 ++ .../neg/unapplySeq-implicit-arg3.check | 0 .../neg/unapplySeq-implicit-arg3.scala | 2 ++ tests/init/neg/early-promote2.scala | 6 ------ tests/init/neg/i15883.scala | 2 -- tests/init/neg/simple1.scala | 4 ---- tests/init/neg/soundness4.scala | 3 --- tests/init/{neg => warn}/AbstractFile.scala | 2 +- tests/init/{neg => warn}/alias.scala | 2 +- tests/init/{neg => warn}/apply.scala | 6 +++--- tests/init/{neg => warn}/apply2.scala | 2 +- .../as-instance-of-cold-field-access.scala | 2 +- tests/init/{neg => warn}/by-name-error.scala | 2 +- tests/init/{neg => warn}/closureLeak.scala | 2 +- .../{neg => warn}/cold-insert-hot-array.scala | 2 +- .../init/{neg => warn}/cycle-structure.scala | 4 ++-- tests/init/{neg => warn}/cycle.scala | 4 ++-- tests/init/{neg => warn}/default-this.scala | 2 +- tests/init/{neg => warn}/early-promote.scala | 2 +- tests/init/warn/early-promote2.scala | 6 ++++++ tests/init/{neg => warn}/early-promote3.scala | 2 +- tests/init/{neg => warn}/early-promote4.scala | 2 +- tests/init/{neg => warn}/early-promote5.scala | 4 ++-- tests/init/{neg => warn}/escape1.scala | 2 +- .../{neg => warn}/features-high-order.scala | 2 +- .../features-linearization.scala | 2 +- tests/init/{neg => warn}/features-trees.scala | 2 +- tests/init/{neg => warn}/final-fields.scala | 8 ++++---- tests/init/{neg => warn}/flow2.scala | 2 +- tests/init/{neg => warn}/function-loop.scala | 2 +- tests/init/{neg => warn}/function1.scala | 4 ++-- tests/init/{neg => warn}/function10.scala | 2 +- tests/init/{neg => warn}/function11.scala | 2 +- tests/init/{neg => warn}/function2.scala | 2 +- tests/init/{neg => warn}/hybrid1.scala | 2 +- tests/init/{neg => warn}/hybrid2.scala | 2 +- tests/init/{neg => warn}/hybrid4.scala | 2 +- tests/init/{neg => warn}/hybrid5.scala | 2 +- tests/init/{neg => warn}/hybrid6.scala | 2 +- tests/init/{neg => warn}/i10549b.scala | 2 +- tests/init/{neg => warn}/i11572.scala | 2 +- tests/init/{neg => warn}/i12544.scala | 2 +- tests/init/{neg => warn}/i15363.scala | 2 +- tests/init/{neg => warn}/i15459.scala | 2 +- tests/init/warn/i15883.scala | 2 ++ tests/init/{neg => warn}/i4031.scala | 2 +- tests/init/{neg => warn}/i4042.scala | 2 +- tests/init/{neg => warn}/i50.scala | 2 +- tests/init/{neg => warn}/i5854.scala | 2 +- .../init/{neg => warn}/inherit-non-hot.scala | 2 +- tests/init/{neg => warn}/inlined-method.scala | 2 +- tests/init/{neg => warn}/inner-case.scala | 2 +- tests/init/{neg => warn}/inner-first.scala | 2 +- tests/init/{neg => warn}/inner-loop.scala | 4 ++-- tests/init/{neg => warn}/inner-new.scala | 2 +- tests/init/{neg => warn}/inner-pat_iuli.scala | 2 +- tests/init/{neg => warn}/inner1.scala | 2 +- tests/init/{neg => warn}/inner11.scala | 2 +- tests/init/{neg => warn}/inner15.scala | 2 +- tests/init/{neg => warn}/inner16.scala | 2 +- tests/init/{neg => warn}/inner17.scala | 2 +- tests/init/{neg => warn}/inner19.scala | 2 +- tests/init/{neg => warn}/inner20.scala | 2 +- tests/init/{neg => warn}/inner21.scala | 4 ++-- tests/init/{neg => warn}/inner22.scala | 2 +- tests/init/{neg => warn}/inner23.scala | 2 +- tests/init/{neg => warn}/inner24.scala | 2 +- tests/init/{neg => warn}/inner25.scala | 2 +- tests/init/{neg => warn}/inner29.scala | 2 +- tests/init/{neg => warn}/inner30.scala | 2 +- tests/init/{neg => warn}/inner4.scala | 2 +- tests/init/{neg => warn}/inner5.scala | 2 +- tests/init/{neg => warn}/inner6.scala | 2 +- tests/init/{neg => warn}/inner7.scala | 2 +- tests/init/{neg => warn}/inner9.scala | 2 +- .../insert-cold-subtype-to-array.scala | 2 +- tests/init/{neg => warn}/java1.scala | 2 +- tests/init/{neg => warn}/lazy.scala | 4 ++-- tests/init/{neg => warn}/lazylist2.scala | 4 ++-- tests/init/{neg => warn}/leak-warm.scala | 2 +- tests/init/{neg => warn}/local-class.scala | 2 +- tests/init/{neg => warn}/override1.scala | 2 +- tests/init/{neg => warn}/override10.scala | 2 +- tests/init/{neg => warn}/override14.scala | 2 +- tests/init/{neg => warn}/override15.scala | 2 +- tests/init/{neg => warn}/override17.scala | 2 +- tests/init/{neg => warn}/override18.scala | 2 +- tests/init/{neg => warn}/override19.scala | 2 +- tests/init/{neg => warn}/override2.scala | 2 +- tests/init/{neg => warn}/override20.scala | 2 +- tests/init/{neg => warn}/override21.scala | 2 +- tests/init/{neg => warn}/override22.scala | 2 +- tests/init/{neg => warn}/override23.scala | 2 +- tests/init/{neg => warn}/override24.scala | 2 +- tests/init/{neg => warn}/override25.scala | 2 +- tests/init/{neg => warn}/override26.scala | 2 +- tests/init/{neg => warn}/override27.scala | 4 ++-- tests/init/{neg => warn}/override28.scala | 2 +- tests/init/{neg => warn}/override29.scala | 2 +- tests/init/{neg => warn}/override3.scala | 2 +- tests/init/{neg => warn}/override30.scala | 2 +- tests/init/{neg => warn}/override31.scala | 2 +- tests/init/{neg => warn}/override32.scala | 2 +- tests/init/{neg => warn}/override33.scala | 2 +- tests/init/{neg => warn}/override34.scala | 2 +- tests/init/{neg => warn}/override35.scala | 2 +- tests/init/{neg => warn}/override36.scala | 2 +- tests/init/{neg => warn}/override38.scala | 2 +- tests/init/{neg => warn}/override39.scala | 2 +- tests/init/{neg => warn}/override4.scala | 2 +- tests/init/{neg => warn}/override40.scala | 2 +- tests/init/{neg => warn}/override41.scala | 2 +- tests/init/{neg => warn}/override42.scala | 2 +- tests/init/{neg => warn}/override43.scala | 2 +- tests/init/{neg => warn}/override44.scala | 2 +- tests/init/{neg => warn}/override45.scala | 2 +- tests/init/{neg => warn}/override46.scala | 2 +- tests/init/{neg => warn}/override5.scala | 4 ++-- tests/init/{neg => warn}/override6.scala | 2 +- tests/init/{neg => warn}/override7.scala | 2 +- tests/init/{neg => warn}/override8.scala | 2 +- tests/init/{neg => warn}/override9.scala | 2 +- tests/init/{neg => warn}/polyfun.scala | 2 +- tests/init/{neg => warn}/private.scala | 2 +- tests/init/{neg => warn}/promote-warm.scala | 2 +- tests/init/{neg => warn}/promote.scala | 2 +- tests/init/{neg => warn}/promotion-loop.scala | 2 +- .../{neg => warn}/promotion-segment.scala | 2 +- .../{neg => warn}/promotion-segment2.scala | 2 +- .../{neg => warn}/promotion-segment3.scala | 2 +- tests/init/{neg => warn}/secondary-ctor.scala | 2 +- .../init/{neg => warn}/secondary-ctor2.scala | 2 +- .../init/{neg => warn}/secondary-ctor3.scala | 2 +- tests/init/warn/simple1.scala | 4 ++++ tests/init/{neg => warn}/simple2.scala | 2 +- tests/init/{neg => warn}/simple3.scala | 2 +- tests/init/{neg => warn}/simple5.scala | 4 ++-- tests/init/{neg => warn}/soundness1.scala | 4 ++-- tests/init/{neg => warn}/soundness2.scala | 2 +- tests/init/warn/soundness4.scala | 3 +++ tests/init/{neg => warn}/soundness6.scala | 2 +- tests/init/{neg => warn}/structural.scala | 2 +- .../init/{neg => warn}/super-resolution.scala | 6 +++--- .../{neg => warn}/super-resolution2.scala | 4 ++-- .../{neg => warn}/super-resolution3.scala | 8 ++++---- tests/init/{neg => warn}/super.scala | 4 ++-- tests/init/{neg => warn}/t3273.scala | 4 ++-- tests/init/{neg => warn}/trees.scala | 2 +- tests/init/{neg => warn}/unsound1.scala | 2 +- tests/init/{neg => warn}/unsound2.scala | 2 +- tests/init/{neg => warn}/unsound3.scala | 2 +- tests/init/{neg => warn}/unsound4.scala | 2 +- tests/warn/i9740d.scala | 4 ++-- 250 files changed, 283 insertions(+), 242 deletions(-) create mode 100644 tests/init-global/neg/context-sensitivity.check mode change 100755 => 100644 tests/init-global/neg/context-sensitivity.scala create mode 100644 tests/init-global/neg/global-cycle14.check create mode 100644 tests/init-global/neg/global-cycle2.check create mode 100644 tests/init-global/neg/global-cycle3.check create mode 100644 tests/init-global/neg/global-cycle4.check create mode 100644 tests/init-global/neg/global-cycle5.check mode change 100755 => 100644 tests/init-global/neg/global-cycle5.scala create mode 100644 tests/init-global/neg/global-cycle6.check create mode 100644 tests/init-global/neg/global-cycle7.check create mode 100644 tests/init-global/neg/global-cycle8.check create mode 100644 tests/init-global/neg/global-irrelevance1.check create mode 100644 tests/init-global/neg/global-irrelevance2.check create mode 100644 tests/init-global/neg/global-irrelevance3.check create mode 100644 tests/init-global/neg/global-irrelevance4.check create mode 100644 tests/init-global/neg/global-irrelevance5.check create mode 100644 tests/init-global/neg/global-irrelevance6.check create mode 100644 tests/init-global/neg/global-irrelevance7.check create mode 100644 tests/init-global/neg/global-list.check mode change 100755 => 100644 tests/init-global/neg/global-list.scala create mode 100644 tests/init-global/neg/global-local-var.check create mode 100644 tests/init-global/neg/global-region1.check create mode 100644 tests/init-global/neg/i11262.check create mode 100644 tests/init-global/neg/i12544b.check create mode 100644 tests/init-global/neg/i9176.check create mode 100644 tests/init-global/neg/mutable-array.check create mode 100644 tests/init-global/neg/mutable-read1.check mode change 100755 => 100644 tests/init-global/neg/mutable-read1.scala create mode 100644 tests/init-global/neg/mutable-read2.check mode change 100755 => 100644 tests/init-global/neg/mutable-read2.scala create mode 100644 tests/init-global/neg/mutable-read3.check mode change 100755 => 100644 tests/init-global/neg/mutable-read3.scala create mode 100644 tests/init-global/neg/mutable-read4.check mode change 100755 => 100644 tests/init-global/neg/mutable-read4.scala create mode 100644 tests/init-global/neg/mutable-read5.check mode change 100755 => 100644 tests/init-global/neg/mutable-read5.scala create mode 100644 tests/init-global/neg/mutable-read6.check mode change 100755 => 100644 tests/init-global/neg/mutable-read6.scala create mode 100644 tests/init-global/neg/mutable-read7.check mode change 100755 => 100644 tests/init-global/neg/mutable-read7.scala create mode 100644 tests/init-global/neg/mutable-read8.check mode change 100755 => 100644 tests/init-global/neg/mutable-read8.scala create mode 100644 tests/init-global/neg/partial-ordering.check mode change 100755 => 100644 tests/init-global/neg/partial-ordering.scala create mode 100644 tests/init-global/neg/patmat-unapplySeq2.check create mode 100644 tests/init-global/neg/patmat.check create mode 100644 tests/init-global/neg/return.check mode change 100755 => 100644 tests/init-global/neg/return.scala create mode 100644 tests/init-global/neg/return2.check mode change 100755 => 100644 tests/init-global/neg/return2.scala create mode 100644 tests/init-global/neg/t5366.check create mode 100644 tests/init-global/neg/t9115.check create mode 100644 tests/init-global/neg/t9261.check create mode 100644 tests/init-global/neg/t9312.check create mode 100644 tests/init-global/neg/t9360.check create mode 100644 tests/init-global/neg/unapply-implicit-arg.check create mode 100644 tests/init-global/neg/unapply-implicit-arg2.check create mode 100644 tests/init-global/neg/unapply-implicit-arg3.check create mode 100644 tests/init-global/neg/unapplySeq-implicit-arg.check create mode 100644 tests/init-global/neg/unapplySeq-implicit-arg2.check create mode 100644 tests/init-global/neg/unapplySeq-implicit-arg3.check delete mode 100644 tests/init/neg/early-promote2.scala delete mode 100644 tests/init/neg/i15883.scala delete mode 100644 tests/init/neg/simple1.scala delete mode 100644 tests/init/neg/soundness4.scala rename tests/init/{neg => warn}/AbstractFile.scala (64%) rename tests/init/{neg => warn}/alias.scala (63%) rename tests/init/{neg => warn}/apply.scala (85%) rename tests/init/{neg => warn}/apply2.scala (76%) mode change 100755 => 100644 rename tests/init/{neg => warn}/as-instance-of-cold-field-access.scala (78%) rename tests/init/{neg => warn}/by-name-error.scala (79%) rename tests/init/{neg => warn}/closureLeak.scala (83%) rename tests/init/{neg => warn}/cold-insert-hot-array.scala (84%) rename tests/init/{neg => warn}/cycle-structure.scala (64%) rename tests/init/{neg => warn}/cycle.scala (59%) rename tests/init/{neg => warn}/default-this.scala (89%) rename tests/init/{neg => warn}/early-promote.scala (84%) create mode 100644 tests/init/warn/early-promote2.scala rename tests/init/{neg => warn}/early-promote3.scala (77%) rename tests/init/{neg => warn}/early-promote4.scala (87%) rename tests/init/{neg => warn}/early-promote5.scala (80%) rename tests/init/{neg => warn}/escape1.scala (71%) rename tests/init/{neg => warn}/features-high-order.scala (81%) rename tests/init/{neg => warn}/features-linearization.scala (82%) rename tests/init/{neg => warn}/features-trees.scala (76%) rename tests/init/{neg => warn}/final-fields.scala (72%) rename tests/init/{neg => warn}/flow2.scala (73%) rename tests/init/{neg => warn}/function-loop.scala (78%) rename tests/init/{neg => warn}/function1.scala (60%) rename tests/init/{neg => warn}/function10.scala (53%) rename tests/init/{neg => warn}/function11.scala (89%) rename tests/init/{neg => warn}/function2.scala (70%) rename tests/init/{neg => warn}/hybrid1.scala (87%) rename tests/init/{neg => warn}/hybrid2.scala (84%) rename tests/init/{neg => warn}/hybrid4.scala (75%) rename tests/init/{neg => warn}/hybrid5.scala (86%) rename tests/init/{neg => warn}/hybrid6.scala (81%) rename tests/init/{neg => warn}/i10549b.scala (81%) rename tests/init/{neg => warn}/i11572.scala (90%) rename tests/init/{neg => warn}/i12544.scala (86%) rename tests/init/{neg => warn}/i15363.scala (78%) rename tests/init/{neg => warn}/i15459.scala (81%) create mode 100644 tests/init/warn/i15883.scala rename tests/init/{neg => warn}/i4031.scala (78%) rename tests/init/{neg => warn}/i4042.scala (87%) rename tests/init/{neg => warn}/i50.scala (64%) rename tests/init/{neg => warn}/i5854.scala (63%) rename tests/init/{neg => warn}/inherit-non-hot.scala (86%) rename tests/init/{neg => warn}/inlined-method.scala (70%) rename tests/init/{neg => warn}/inner-case.scala (82%) rename tests/init/{neg => warn}/inner-first.scala (69%) rename tests/init/{neg => warn}/inner-loop.scala (88%) rename tests/init/{neg => warn}/inner-new.scala (80%) rename tests/init/{neg => warn}/inner-pat_iuli.scala (92%) rename tests/init/{neg => warn}/inner1.scala (80%) rename tests/init/{neg => warn}/inner11.scala (93%) rename tests/init/{neg => warn}/inner15.scala (84%) rename tests/init/{neg => warn}/inner16.scala (87%) rename tests/init/{neg => warn}/inner17.scala (78%) rename tests/init/{neg => warn}/inner19.scala (79%) rename tests/init/{neg => warn}/inner20.scala (84%) rename tests/init/{neg => warn}/inner21.scala (71%) rename tests/init/{neg => warn}/inner22.scala (92%) rename tests/init/{neg => warn}/inner23.scala (77%) rename tests/init/{neg => warn}/inner24.scala (84%) rename tests/init/{neg => warn}/inner25.scala (91%) rename tests/init/{neg => warn}/inner29.scala (83%) rename tests/init/{neg => warn}/inner30.scala (93%) rename tests/init/{neg => warn}/inner4.scala (77%) rename tests/init/{neg => warn}/inner5.scala (76%) rename tests/init/{neg => warn}/inner6.scala (91%) rename tests/init/{neg => warn}/inner7.scala (81%) rename tests/init/{neg => warn}/inner9.scala (83%) rename tests/init/{neg => warn}/insert-cold-subtype-to-array.scala (84%) rename tests/init/{neg => warn}/java1.scala (91%) rename tests/init/{neg => warn}/lazy.scala (69%) rename tests/init/{neg => warn}/lazylist2.scala (89%) rename tests/init/{neg => warn}/leak-warm.scala (91%) rename tests/init/{neg => warn}/local-class.scala (84%) rename tests/init/{neg => warn}/override1.scala (84%) rename tests/init/{neg => warn}/override10.scala (75%) rename tests/init/{neg => warn}/override14.scala (76%) rename tests/init/{neg => warn}/override15.scala (81%) rename tests/init/{neg => warn}/override17.scala (76%) rename tests/init/{neg => warn}/override18.scala (88%) rename tests/init/{neg => warn}/override19.scala (79%) rename tests/init/{neg => warn}/override2.scala (89%) rename tests/init/{neg => warn}/override20.scala (75%) rename tests/init/{neg => warn}/override21.scala (86%) rename tests/init/{neg => warn}/override22.scala (87%) rename tests/init/{neg => warn}/override23.scala (87%) rename tests/init/{neg => warn}/override24.scala (91%) rename tests/init/{neg => warn}/override25.scala (85%) rename tests/init/{neg => warn}/override26.scala (85%) rename tests/init/{neg => warn}/override27.scala (73%) rename tests/init/{neg => warn}/override28.scala (72%) rename tests/init/{neg => warn}/override29.scala (78%) rename tests/init/{neg => warn}/override3.scala (91%) rename tests/init/{neg => warn}/override30.scala (79%) rename tests/init/{neg => warn}/override31.scala (84%) rename tests/init/{neg => warn}/override32.scala (80%) rename tests/init/{neg => warn}/override33.scala (85%) rename tests/init/{neg => warn}/override34.scala (79%) rename tests/init/{neg => warn}/override35.scala (77%) rename tests/init/{neg => warn}/override36.scala (87%) rename tests/init/{neg => warn}/override38.scala (77%) rename tests/init/{neg => warn}/override39.scala (82%) rename tests/init/{neg => warn}/override4.scala (82%) rename tests/init/{neg => warn}/override40.scala (80%) rename tests/init/{neg => warn}/override41.scala (82%) rename tests/init/{neg => warn}/override42.scala (81%) rename tests/init/{neg => warn}/override43.scala (83%) rename tests/init/{neg => warn}/override44.scala (83%) rename tests/init/{neg => warn}/override45.scala (81%) rename tests/init/{neg => warn}/override46.scala (75%) rename tests/init/{neg => warn}/override5.scala (78%) rename tests/init/{neg => warn}/override6.scala (70%) rename tests/init/{neg => warn}/override7.scala (87%) rename tests/init/{neg => warn}/override8.scala (93%) rename tests/init/{neg => warn}/override9.scala (64%) rename tests/init/{neg => warn}/polyfun.scala (72%) rename tests/init/{neg => warn}/private.scala (84%) rename tests/init/{neg => warn}/promote-warm.scala (84%) rename tests/init/{neg => warn}/promote.scala (82%) rename tests/init/{neg => warn}/promotion-loop.scala (86%) rename tests/init/{neg => warn}/promotion-segment.scala (85%) rename tests/init/{neg => warn}/promotion-segment2.scala (87%) rename tests/init/{neg => warn}/promotion-segment3.scala (82%) rename tests/init/{neg => warn}/secondary-ctor.scala (87%) rename tests/init/{neg => warn}/secondary-ctor2.scala (91%) rename tests/init/{neg => warn}/secondary-ctor3.scala (94%) create mode 100644 tests/init/warn/simple1.scala rename tests/init/{neg => warn}/simple2.scala (86%) rename tests/init/{neg => warn}/simple3.scala (64%) rename tests/init/{neg => warn}/simple5.scala (68%) rename tests/init/{neg => warn}/soundness1.scala (81%) rename tests/init/{neg => warn}/soundness2.scala (50%) create mode 100644 tests/init/warn/soundness4.scala rename tests/init/{neg => warn}/soundness6.scala (58%) rename tests/init/{neg => warn}/structural.scala (86%) rename tests/init/{neg => warn}/super-resolution.scala (82%) rename tests/init/{neg => warn}/super-resolution2.scala (84%) rename tests/init/{neg => warn}/super-resolution3.scala (81%) rename tests/init/{neg => warn}/super.scala (87%) rename tests/init/{neg => warn}/t3273.scala (90%) rename tests/init/{neg => warn}/trees.scala (78%) rename tests/init/{neg => warn}/unsound1.scala (80%) rename tests/init/{neg => warn}/unsound2.scala (88%) rename tests/init/{neg => warn}/unsound3.scala (72%) rename tests/init/{neg => warn}/unsound4.scala (70%) diff --git a/tests/init-global/neg/context-sensitivity.check b/tests/init-global/neg/context-sensitivity.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/context-sensitivity.scala b/tests/init-global/neg/context-sensitivity.scala old mode 100755 new mode 100644 index 626fd41bb43f..98d1ca13b3fd --- a/tests/init-global/neg/context-sensitivity.scala +++ b/tests/init-global/neg/context-sensitivity.scala @@ -15,3 +15,5 @@ object A: val box1: Box = new Box(new C(5)) val box2: Box = new Box(new D(10)) val m: Int = box1.value.foo() + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle1.check b/tests/init-global/neg/global-cycle1.check index faed741761a7..e69de29bb2d1 100644 --- a/tests/init-global/neg/global-cycle1.check +++ b/tests/init-global/neg/global-cycle1.check @@ -1,20 +0,0 @@ --- Error: tests/init-global/neg/global-cycle1.scala:1:7 ---------------------------------------------------------------- -1 |object A { // error - | ^ - | Cyclic initialization: object A -> object B -> object A. Calling trace: - | -> object A { // error [ global-cycle1.scala:1 ] - | ^ - | -> val a: Int = B.b [ global-cycle1.scala:2 ] - | ^ - | -> object B { [ global-cycle1.scala:5 ] - | ^ - | -> val b: Int = A.a // error [ global-cycle1.scala:6 ] - | ^ --- Error: tests/init-global/neg/global-cycle1.scala:6:17 --------------------------------------------------------------- -6 | val b: Int = A.a // error - | ^^^ - | Access uninitialized field value a. Call trace: - | -> object B { [ global-cycle1.scala:5 ] - | ^ - | -> val b: Int = A.a // error [ global-cycle1.scala:6 ] - | ^^^ diff --git a/tests/init-global/neg/global-cycle1.scala b/tests/init-global/neg/global-cycle1.scala index 592f5a652dc8..f52dcce31832 100644 --- a/tests/init-global/neg/global-cycle1.scala +++ b/tests/init-global/neg/global-cycle1.scala @@ -8,3 +8,5 @@ object B { @main def Test = print(A.a) + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle14.check b/tests/init-global/neg/global-cycle14.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-cycle14.scala b/tests/init-global/neg/global-cycle14.scala index bcacbebb74fa..2cba92c23624 100644 --- a/tests/init-global/neg/global-cycle14.scala +++ b/tests/init-global/neg/global-cycle14.scala @@ -12,3 +12,5 @@ object A { // error object B { val m: Int = A.n // error } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle2.check b/tests/init-global/neg/global-cycle2.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-cycle2.scala b/tests/init-global/neg/global-cycle2.scala index d86fe09fb0fa..ccf865d58cbf 100644 --- a/tests/init-global/neg/global-cycle2.scala +++ b/tests/init-global/neg/global-cycle2.scala @@ -5,3 +5,5 @@ object A { object B { def foo(): Int = A.a * 2 // error } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle3.check b/tests/init-global/neg/global-cycle3.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-cycle3.scala b/tests/init-global/neg/global-cycle3.scala index 405e007b044a..cf24db395d1c 100644 --- a/tests/init-global/neg/global-cycle3.scala +++ b/tests/init-global/neg/global-cycle3.scala @@ -5,3 +5,5 @@ class A(x: Int) { object B { val a: Int = A(4).foo() } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle4.check b/tests/init-global/neg/global-cycle4.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-cycle4.scala b/tests/init-global/neg/global-cycle4.scala index 8c1627afeae4..587ee948fba1 100644 --- a/tests/init-global/neg/global-cycle4.scala +++ b/tests/init-global/neg/global-cycle4.scala @@ -17,3 +17,5 @@ class D(x: Int) { object O { val a: Int = D(5).bar().foo() } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle5.check b/tests/init-global/neg/global-cycle5.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-cycle5.scala b/tests/init-global/neg/global-cycle5.scala old mode 100755 new mode 100644 index 1ba3435d3830..d0951d6c8972 --- a/tests/init-global/neg/global-cycle5.scala +++ b/tests/init-global/neg/global-cycle5.scala @@ -20,4 +20,5 @@ object C { def main = { A.a = new Y(); C -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle6.check b/tests/init-global/neg/global-cycle6.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-cycle6.scala b/tests/init-global/neg/global-cycle6.scala index 36e3ab0b6a94..a1d9e64689b9 100644 --- a/tests/init-global/neg/global-cycle6.scala +++ b/tests/init-global/neg/global-cycle6.scala @@ -22,4 +22,5 @@ object O { val a = new A.Inner val m: Int = 10 } -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle7.check b/tests/init-global/neg/global-cycle7.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-cycle7.scala b/tests/init-global/neg/global-cycle7.scala index aea75726fbf7..a0f0d0379b3d 100644 --- a/tests/init-global/neg/global-cycle7.scala +++ b/tests/init-global/neg/global-cycle7.scala @@ -16,3 +16,5 @@ object JavaTokens extends TokensCommon { final def maxToken: Int = DOUBLE final val DOUBLE = 188 } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle8.check b/tests/init-global/neg/global-cycle8.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-cycle8.scala b/tests/init-global/neg/global-cycle8.scala index 344dc3241395..648711ef8772 100644 --- a/tests/init-global/neg/global-cycle8.scala +++ b/tests/init-global/neg/global-cycle8.scala @@ -18,3 +18,5 @@ object P { object Q { def bar(b: B) = b.a.foo() } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance1.check b/tests/init-global/neg/global-irrelevance1.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-irrelevance1.scala b/tests/init-global/neg/global-irrelevance1.scala index 903d3b14ae18..18c1c16b5ed6 100644 --- a/tests/init-global/neg/global-irrelevance1.scala +++ b/tests/init-global/neg/global-irrelevance1.scala @@ -2,4 +2,5 @@ object A: var x = 6 object B: - var y = A.x * 2 // error \ No newline at end of file + var y = A.x * 2 // error +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance2.check b/tests/init-global/neg/global-irrelevance2.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-irrelevance2.scala b/tests/init-global/neg/global-irrelevance2.scala index 66b06677b689..99aed8a0dd47 100644 --- a/tests/init-global/neg/global-irrelevance2.scala +++ b/tests/init-global/neg/global-irrelevance2.scala @@ -6,3 +6,5 @@ class B(b: Int): object B: new B(10) + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance3.check b/tests/init-global/neg/global-irrelevance3.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-irrelevance3.scala b/tests/init-global/neg/global-irrelevance3.scala index 2f36d65d917e..d90514f2c489 100644 --- a/tests/init-global/neg/global-irrelevance3.scala +++ b/tests/init-global/neg/global-irrelevance3.scala @@ -12,3 +12,5 @@ object A: object B: var y = A.p.g() + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance4.check b/tests/init-global/neg/global-irrelevance4.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-irrelevance4.scala b/tests/init-global/neg/global-irrelevance4.scala index 7a2a778814b2..06c0694fba2e 100644 --- a/tests/init-global/neg/global-irrelevance4.scala +++ b/tests/init-global/neg/global-irrelevance4.scala @@ -11,3 +11,5 @@ object A: object B: A.p.f(10) + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance5.check b/tests/init-global/neg/global-irrelevance5.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-irrelevance5.scala b/tests/init-global/neg/global-irrelevance5.scala index fd5bde3032aa..1ab0ed645524 100644 --- a/tests/init-global/neg/global-irrelevance5.scala +++ b/tests/init-global/neg/global-irrelevance5.scala @@ -4,3 +4,5 @@ object A: object B: var y = A.array(0) * 2 // error + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance6.check b/tests/init-global/neg/global-irrelevance6.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-irrelevance6.scala b/tests/init-global/neg/global-irrelevance6.scala index 78699b6988b6..c624cd91cff6 100644 --- a/tests/init-global/neg/global-irrelevance6.scala +++ b/tests/init-global/neg/global-irrelevance6.scala @@ -7,3 +7,5 @@ object A: object B: var y = A.array(0).foo() * 2 // error + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance7.check b/tests/init-global/neg/global-irrelevance7.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-irrelevance7.scala b/tests/init-global/neg/global-irrelevance7.scala index 2c860cbc4259..f87b97a33cad 100644 --- a/tests/init-global/neg/global-irrelevance7.scala +++ b/tests/init-global/neg/global-irrelevance7.scala @@ -8,3 +8,5 @@ object A: object B: var y = A.array(0).foo() * 2 // error + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-list.check b/tests/init-global/neg/global-list.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-list.scala b/tests/init-global/neg/global-list.scala old mode 100755 new mode 100644 index cdef6dbf3bbe..062cdce5cdca --- a/tests/init-global/neg/global-list.scala +++ b/tests/init-global/neg/global-list.scala @@ -6,4 +6,5 @@ object O: // error val c = Foo("Cherry") object Foo: - val all: List[Foo] = List(O.a, O.b, O.c) // error // error // error \ No newline at end of file + val all: List[Foo] = List(O.a, O.b, O.c) // error // error // error +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-local-var.check b/tests/init-global/neg/global-local-var.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-local-var.scala b/tests/init-global/neg/global-local-var.scala index 6965a42bd37f..aa0b000b1970 100644 --- a/tests/init-global/neg/global-local-var.scala +++ b/tests/init-global/neg/global-local-var.scala @@ -14,3 +14,5 @@ class A(x: Int) { object B { val a: Int = A(4).foo() } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-region1.check b/tests/init-global/neg/global-region1.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/global-region1.scala b/tests/init-global/neg/global-region1.scala index 48473717b5b5..82e50f985fa7 100644 --- a/tests/init-global/neg/global-region1.scala +++ b/tests/init-global/neg/global-region1.scala @@ -7,3 +7,5 @@ object A: val box1: Box = new Box(new C(5)) val box2: Box = new Box(new D(10)) val m: Int = box1.value.foo() + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/i11262.check b/tests/init-global/neg/i11262.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/i11262.scala b/tests/init-global/neg/i11262.scala index c1c01f6aad8c..54b29c38e2b2 100644 --- a/tests/init-global/neg/i11262.scala +++ b/tests/init-global/neg/i11262.scala @@ -1,2 +1,4 @@ object A { val x: String = B.y } // error object B { val y: String = A.x } // error + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/i12544b.check b/tests/init-global/neg/i12544b.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/i12544b.scala b/tests/init-global/neg/i12544b.scala index 586b88df04bd..7128e455386a 100644 --- a/tests/init-global/neg/i12544b.scala +++ b/tests/init-global/neg/i12544b.scala @@ -10,3 +10,5 @@ object Enum: def f(e: Enum): Enum = e @main def main(): Unit = println(Enum.b) + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/i9176.check b/tests/init-global/neg/i9176.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/i9176.scala b/tests/init-global/neg/i9176.scala index c93a16f2f8b1..b32ed4febd21 100644 --- a/tests/init-global/neg/i9176.scala +++ b/tests/init-global/neg/i9176.scala @@ -7,3 +7,5 @@ object Test { println(B.opposite) } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/line-spacing.check b/tests/init-global/neg/line-spacing.check index ab44d7d1dc65..e69de29bb2d1 100644 --- a/tests/init-global/neg/line-spacing.check +++ b/tests/init-global/neg/line-spacing.check @@ -1,13 +0,0 @@ --- Error: tests/init-global/neg/line-spacing.scala:4:7 ----------------------------------------------------------------- -3 | B -4 | .s.length // error - | ^ - | Access uninitialized field value s. Call trace: - | -> object B { [ line-spacing.scala:7 ] - | ^ - | -> val s: String = s"${A.a}a" [ line-spacing.scala:8 ] - | ^^^ - | -> def a: Int = [ line-spacing.scala:2 ] - | ^ - | -> .s.length // error [ line-spacing.scala:4 ] - | ^ diff --git a/tests/init-global/neg/line-spacing.scala b/tests/init-global/neg/line-spacing.scala index 42474decb53c..27e55e0177a0 100644 --- a/tests/init-global/neg/line-spacing.scala +++ b/tests/init-global/neg/line-spacing.scala @@ -7,3 +7,5 @@ object A { object B { val s: String = s"${A.a}a" } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-array.check b/tests/init-global/neg/mutable-array.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/mutable-array.scala b/tests/init-global/neg/mutable-array.scala index 3cbc23a5e127..f78e721d1491 100644 --- a/tests/init-global/neg/mutable-array.scala +++ b/tests/init-global/neg/mutable-array.scala @@ -6,3 +6,5 @@ object B: val boxes: Array[A.Box] = Array(A.box) val box: A.Box = boxes(0) val x: Int = box.value // error + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read1.check b/tests/init-global/neg/mutable-read1.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/mutable-read1.scala b/tests/init-global/neg/mutable-read1.scala old mode 100755 new mode 100644 index 507a8b7d74ad..a4f6ae972b71 --- a/tests/init-global/neg/mutable-read1.scala +++ b/tests/init-global/neg/mutable-read1.scala @@ -7,4 +7,5 @@ object B: val boxB: Box = new Box(5) val boxA: Box = A.box val m: Int = boxB.value - val n: Int = boxA.value // error \ No newline at end of file + val n: Int = boxA.value // error +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read2.check b/tests/init-global/neg/mutable-read2.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/mutable-read2.scala b/tests/init-global/neg/mutable-read2.scala old mode 100755 new mode 100644 index e7653c63d8bb..340bc003b5d4 --- a/tests/init-global/neg/mutable-read2.scala +++ b/tests/init-global/neg/mutable-read2.scala @@ -7,4 +7,5 @@ object A: object B: val box: A.Box = A.box val a: Int = box.initial - val b: Int = box.value // error \ No newline at end of file + val b: Int = box.value // error +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read3.check b/tests/init-global/neg/mutable-read3.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/mutable-read3.scala b/tests/init-global/neg/mutable-read3.scala old mode 100755 new mode 100644 index d103e112f372..46ce43543bb4 --- a/tests/init-global/neg/mutable-read3.scala +++ b/tests/init-global/neg/mutable-read3.scala @@ -6,4 +6,5 @@ object B: val boxes: Array[A.Box] = new Array(1) boxes(0) = A.box val box: A.Box = boxes(0) - val x: Int = box.value // error \ No newline at end of file + val x: Int = box.value // error +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read4.check b/tests/init-global/neg/mutable-read4.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/mutable-read4.scala b/tests/init-global/neg/mutable-read4.scala old mode 100755 new mode 100644 index 507a8b7d74ad..a4f6ae972b71 --- a/tests/init-global/neg/mutable-read4.scala +++ b/tests/init-global/neg/mutable-read4.scala @@ -7,4 +7,5 @@ object B: val boxB: Box = new Box(5) val boxA: Box = A.box val m: Int = boxB.value - val n: Int = boxA.value // error \ No newline at end of file + val n: Int = boxA.value // error +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read5.check b/tests/init-global/neg/mutable-read5.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/mutable-read5.scala b/tests/init-global/neg/mutable-read5.scala old mode 100755 new mode 100644 index c166295bf9fa..3d5b59236f02 --- a/tests/init-global/neg/mutable-read5.scala +++ b/tests/init-global/neg/mutable-read5.scala @@ -6,4 +6,5 @@ object Names: object StdNames: val AnyRef: Names.Name = Names.name("AnyRef") val Array: Names.Name = Names.name("Array") - val List: Names.Name = Names.name("List") \ No newline at end of file + val List: Names.Name = Names.name("List") +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read6.check b/tests/init-global/neg/mutable-read6.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/mutable-read6.scala b/tests/init-global/neg/mutable-read6.scala old mode 100755 new mode 100644 index 8b00eeaf4216..852d5c7de9cb --- a/tests/init-global/neg/mutable-read6.scala +++ b/tests/init-global/neg/mutable-read6.scala @@ -12,4 +12,5 @@ object Contexts: object Implicits: import Contexts.* case class SearchFailure(tag: Int, source: SourceFile) - val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source) \ No newline at end of file + val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source) +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read7.check b/tests/init-global/neg/mutable-read7.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/mutable-read7.scala b/tests/init-global/neg/mutable-read7.scala old mode 100755 new mode 100644 index ad9d154d74f5..7084b4a17566 --- a/tests/init-global/neg/mutable-read7.scala +++ b/tests/init-global/neg/mutable-read7.scala @@ -10,4 +10,5 @@ abstract class Positioned: object Trees: class Tree extends Positioned - val emptyTree = new Tree \ No newline at end of file + val emptyTree = new Tree +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read8.check b/tests/init-global/neg/mutable-read8.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/mutable-read8.scala b/tests/init-global/neg/mutable-read8.scala old mode 100755 new mode 100644 index e830fa65be73..7cf991aabaa4 --- a/tests/init-global/neg/mutable-read8.scala +++ b/tests/init-global/neg/mutable-read8.scala @@ -8,4 +8,5 @@ class UncachedGroundType { class LazyType extends UncachedGroundType -object NoCompleter extends LazyType \ No newline at end of file +object NoCompleter extends LazyType +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/partial-ordering.check b/tests/init-global/neg/partial-ordering.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/partial-ordering.scala b/tests/init-global/neg/partial-ordering.scala old mode 100755 new mode 100644 index 1bc1b251fb72..b3d32da1bc14 --- a/tests/init-global/neg/partial-ordering.scala +++ b/tests/init-global/neg/partial-ordering.scala @@ -5,4 +5,5 @@ object Names: // error class MethodName(encoded: String) object MethodName: val ctor: MethodName = new MethodName(Names.ctorString) - def apply(name: String): MethodName = new MethodName(name) \ No newline at end of file + def apply(name: String): MethodName = new MethodName(name) +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/patmat-unapplySeq.check b/tests/init-global/neg/patmat-unapplySeq.check index 74093b029614..e69de29bb2d1 100644 --- a/tests/init-global/neg/patmat-unapplySeq.check +++ b/tests/init-global/neg/patmat-unapplySeq.check @@ -1,11 +0,0 @@ --- Error: tests/init-global/neg/patmat-unapplySeq.scala:8:32 ----------------------------------------------------------- -8 | def apply(i: Int): Box = array(i) // error - | ^^^^^^^^ - |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ patmat-unapplySeq.scala:15 ] - | ^ - |-> case A(b) => [ patmat-unapplySeq.scala:17 ] - | ^^^^ - |-> def apply(i: Int): Box = array(i) // error [ patmat-unapplySeq.scala:8 ] - | ^^^^^^^^ diff --git a/tests/init-global/neg/patmat-unapplySeq.scala b/tests/init-global/neg/patmat-unapplySeq.scala index 81c853a6e19f..0169f898d5f9 100644 --- a/tests/init-global/neg/patmat-unapplySeq.scala +++ b/tests/init-global/neg/patmat-unapplySeq.scala @@ -15,3 +15,5 @@ object A: object B: A.array match case A(b) => + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/patmat-unapplySeq2.check b/tests/init-global/neg/patmat-unapplySeq2.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/patmat-unapplySeq2.scala b/tests/init-global/neg/patmat-unapplySeq2.scala index adab9495db49..059f53f4c812 100644 --- a/tests/init-global/neg/patmat-unapplySeq2.scala +++ b/tests/init-global/neg/patmat-unapplySeq2.scala @@ -15,3 +15,5 @@ object A: object B: A.array match case A(b*) => + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/patmat.check b/tests/init-global/neg/patmat.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/patmat.scala b/tests/init-global/neg/patmat.scala index 126e66e7cf7b..1c817d0af63d 100644 --- a/tests/init-global/neg/patmat.scala +++ b/tests/init-global/neg/patmat.scala @@ -34,3 +34,5 @@ object C: (Box(foo): Box[() => Int] | Holder[Int]) match case Box(f) => f() case Holder(x) => x + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/return.check b/tests/init-global/neg/return.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/return.scala b/tests/init-global/neg/return.scala old mode 100755 new mode 100644 index 5cbf6915fc0e..e493c830f60f --- a/tests/init-global/neg/return.scala +++ b/tests/init-global/neg/return.scala @@ -8,3 +8,5 @@ object A: object B: val n = A.foo(-10)(20) + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/return2.check b/tests/init-global/neg/return2.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/return2.scala b/tests/init-global/neg/return2.scala old mode 100755 new mode 100644 index 6a4dec50c2dd..d8dcfb0b05cc --- a/tests/init-global/neg/return2.scala +++ b/tests/init-global/neg/return2.scala @@ -11,3 +11,5 @@ object A: object B: val n = A.foo(-10)(20) + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/t5366.check b/tests/init-global/neg/t5366.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/t5366.scala b/tests/init-global/neg/t5366.scala index 854bdfe0544b..d358f1cfb04d 100644 --- a/tests/init-global/neg/t5366.scala +++ b/tests/init-global/neg/t5366.scala @@ -12,4 +12,5 @@ object Test { ObjA println(IdAndMsg.values) } -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/t9115.check b/tests/init-global/neg/t9115.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/t9115.scala b/tests/init-global/neg/t9115.scala index a3020c6939a8..253cfe289d7d 100644 --- a/tests/init-global/neg/t9115.scala +++ b/tests/init-global/neg/t9115.scala @@ -6,3 +6,5 @@ object D { // error println(D1) println(D2) } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/t9261.check b/tests/init-global/neg/t9261.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/t9261.scala b/tests/init-global/neg/t9261.scala index 1e23bedb9b6a..12f4f8facdbf 100644 --- a/tests/init-global/neg/t9261.scala +++ b/tests/init-global/neg/t9261.scala @@ -1,3 +1,5 @@ sealed abstract class OrderType(val reverse: OrderType) case object Buy extends OrderType(Sell) // error case object Sell extends OrderType(Buy) + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/t9312.check b/tests/init-global/neg/t9312.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/t9312.scala b/tests/init-global/neg/t9312.scala index d88093a2f67a..f9d8eae56b4a 100644 --- a/tests/init-global/neg/t9312.scala +++ b/tests/init-global/neg/t9312.scala @@ -21,3 +21,5 @@ object DeadLockTest { final val children = Set(Child1, Child2) } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/t9360.check b/tests/init-global/neg/t9360.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/t9360.scala b/tests/init-global/neg/t9360.scala index 2ec0c740d739..29b1a1fd4ae9 100644 --- a/tests/init-global/neg/t9360.scala +++ b/tests/init-global/neg/t9360.scala @@ -23,3 +23,5 @@ object ObjectInit { Obj.print } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/unapply-implicit-arg.check b/tests/init-global/neg/unapply-implicit-arg.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/unapply-implicit-arg.scala b/tests/init-global/neg/unapply-implicit-arg.scala index bf41fbbf9412..b963cbe38313 100644 --- a/tests/init-global/neg/unapply-implicit-arg.scala +++ b/tests/init-global/neg/unapply-implicit-arg.scala @@ -11,4 +11,5 @@ object Bar { val i2: Int = i2 match // error case Bar(i) => i case _ => 0 -} \ No newline at end of file +} +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/unapply-implicit-arg2.check b/tests/init-global/neg/unapply-implicit-arg2.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/unapply-implicit-arg2.scala b/tests/init-global/neg/unapply-implicit-arg2.scala index c0a16faac377..56ac8afef5ed 100644 --- a/tests/init-global/neg/unapply-implicit-arg2.scala +++ b/tests/init-global/neg/unapply-implicit-arg2.scala @@ -12,3 +12,5 @@ object Bar { case Bar(i) => i case _ => 0 } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/unapply-implicit-arg3.check b/tests/init-global/neg/unapply-implicit-arg3.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/unapply-implicit-arg3.scala b/tests/init-global/neg/unapply-implicit-arg3.scala index efa348f6cfdb..89972fa4a277 100644 --- a/tests/init-global/neg/unapply-implicit-arg3.scala +++ b/tests/init-global/neg/unapply-implicit-arg3.scala @@ -12,3 +12,5 @@ object Bar { case Bar(i) => i case _ => 0 } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/unapplySeq-implicit-arg.check b/tests/init-global/neg/unapplySeq-implicit-arg.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/unapplySeq-implicit-arg.scala b/tests/init-global/neg/unapplySeq-implicit-arg.scala index e58635a3090f..4ed854a9dd20 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg.scala +++ b/tests/init-global/neg/unapplySeq-implicit-arg.scala @@ -12,3 +12,5 @@ object Bar { case Bar(i) => i case _ => 0 } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/unapplySeq-implicit-arg2.check b/tests/init-global/neg/unapplySeq-implicit-arg2.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/unapplySeq-implicit-arg2.scala b/tests/init-global/neg/unapplySeq-implicit-arg2.scala index 35f5105b84d2..c598fe849b81 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg2.scala +++ b/tests/init-global/neg/unapplySeq-implicit-arg2.scala @@ -8,3 +8,5 @@ object Bar { case _ => 0 } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/unapplySeq-implicit-arg3.check b/tests/init-global/neg/unapplySeq-implicit-arg3.check new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/init-global/neg/unapplySeq-implicit-arg3.scala b/tests/init-global/neg/unapplySeq-implicit-arg3.scala index 2b5cdd327e57..1e1b5a5116b0 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg3.scala +++ b/tests/init-global/neg/unapplySeq-implicit-arg3.scala @@ -10,3 +10,5 @@ object Bar { case _ => 0 } } + +// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init/neg/early-promote2.scala b/tests/init/neg/early-promote2.scala deleted file mode 100644 index 514aed36a8ed..000000000000 --- a/tests/init/neg/early-promote2.scala +++ /dev/null @@ -1,6 +0,0 @@ -class M { - println(this) // error - foo() - private val a = 5 // error - def foo() = a -} diff --git a/tests/init/neg/i15883.scala b/tests/init/neg/i15883.scala deleted file mode 100644 index 6f6e3066a878..000000000000 --- a/tests/init/neg/i15883.scala +++ /dev/null @@ -1,2 +0,0 @@ -val a = b -val b = 1 // error diff --git a/tests/init/neg/simple1.scala b/tests/init/neg/simple1.scala deleted file mode 100644 index 93fba24008b9..000000000000 --- a/tests/init/neg/simple1.scala +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - val len = name.size - val name: String = "Jack" // error -} \ No newline at end of file diff --git a/tests/init/neg/soundness4.scala b/tests/init/neg/soundness4.scala deleted file mode 100644 index 308856b5e870..000000000000 --- a/tests/init/neg/soundness4.scala +++ /dev/null @@ -1,3 +0,0 @@ -class Foo { - val a : Foo = this.a.a // error -} \ No newline at end of file diff --git a/tests/init/neg/AbstractFile.scala b/tests/init/warn/AbstractFile.scala similarity index 64% rename from tests/init/neg/AbstractFile.scala rename to tests/init/warn/AbstractFile.scala index f4f38982608a..bb8abc6e8322 100644 --- a/tests/init/neg/AbstractFile.scala +++ b/tests/init/warn/AbstractFile.scala @@ -4,6 +4,6 @@ abstract class AbstractFile { } class RemoteFile(url: String) extends AbstractFile { - val localFile: String = s"${url.##}.tmp" // error: usage of `localFile` before it's initialized + val localFile: String = s"${url.##}.tmp" // warn: usage of `localFile` before it's initialized def name: String = localFile } diff --git a/tests/init/neg/alias.scala b/tests/init/warn/alias.scala similarity index 63% rename from tests/init/neg/alias.scala rename to tests/init/warn/alias.scala index 79367b36d0c5..8e9cb56b75c0 100644 --- a/tests/init/neg/alias.scala +++ b/tests/init/warn/alias.scala @@ -1,5 +1,5 @@ class Foo { val self = this val x = self.n - val n = 10 // error + val n = 10 // warn } \ No newline at end of file diff --git a/tests/init/neg/apply.scala b/tests/init/warn/apply.scala similarity index 85% rename from tests/init/neg/apply.scala rename to tests/init/warn/apply.scala index 2847115cc73c..fffa4c59968f 100644 --- a/tests/init/neg/apply.scala +++ b/tests/init/warn/apply.scala @@ -6,7 +6,7 @@ object A: class B: val a = A(this) - val a2 = A.foo(this) // error + val a2 = A.foo(this) // warn val a3 = A.bar(this) // test receiver is ThisRef @@ -20,7 +20,7 @@ object O: class B: val a = A(this) - val a2 = A.foo(this) // error + val a2 = A.foo(this) // warn val a3 = A.bar(this) val b = new B @@ -38,7 +38,7 @@ class M(n: N): class B: val a = A(this) - val a2 = A.foo(this) // error + val a2 = A.foo(this) // warn val a3 = A.bar(this) end M diff --git a/tests/init/neg/apply2.scala b/tests/init/warn/apply2.scala old mode 100755 new mode 100644 similarity index 76% rename from tests/init/neg/apply2.scala rename to tests/init/warn/apply2.scala index c6c7fe5fedd2..b81dfa5e7a57 --- a/tests/init/neg/apply2.scala +++ b/tests/init/warn/apply2.scala @@ -3,7 +3,7 @@ object O: println(n) class B: - val a = A(this) // error + val a = A(this) // warn val b = new B val n = 10 diff --git a/tests/init/neg/as-instance-of-cold-field-access.scala b/tests/init/warn/as-instance-of-cold-field-access.scala similarity index 78% rename from tests/init/neg/as-instance-of-cold-field-access.scala rename to tests/init/warn/as-instance-of-cold-field-access.scala index c8de99e96d0e..caef6f42f623 100644 --- a/tests/init/neg/as-instance-of-cold-field-access.scala +++ b/tests/init/warn/as-instance-of-cold-field-access.scala @@ -1,7 +1,7 @@ final class MyAsInstanceOfClass(o: MyAsInstanceOfClass) { val other: MyAsInstanceOfClass = { if (o.asInstanceOf[MyAsInstanceOfClass].oRef ne null) o - else new MyAsInstanceOfClass(this) // error + else new MyAsInstanceOfClass(this) // warn } val oRef = o } diff --git a/tests/init/neg/by-name-error.scala b/tests/init/warn/by-name-error.scala similarity index 79% rename from tests/init/neg/by-name-error.scala rename to tests/init/warn/by-name-error.scala index 960bbe9bf7e9..8d3a690c7cfd 100644 --- a/tests/init/neg/by-name-error.scala +++ b/tests/init/warn/by-name-error.scala @@ -8,6 +8,6 @@ object Foo { } class A { - val foo = implicitly[Foo] // error + val foo = implicitly[Foo] // warn assert(foo eq foo.next) } \ No newline at end of file diff --git a/tests/init/neg/closureLeak.scala b/tests/init/warn/closureLeak.scala similarity index 83% rename from tests/init/neg/closureLeak.scala rename to tests/init/warn/closureLeak.scala index ae7db5124028..3e4e1f88102b 100644 --- a/tests/init/neg/closureLeak.scala +++ b/tests/init/warn/closureLeak.scala @@ -8,6 +8,6 @@ class Outer { } val l: List[A] = List(new A(5), new A(10)) - l.foreach(a => a.addX(this)) // error + l.foreach(a => a.addX(this)) // warn val p = 10 } diff --git a/tests/init/neg/cold-insert-hot-array.scala b/tests/init/warn/cold-insert-hot-array.scala similarity index 84% rename from tests/init/neg/cold-insert-hot-array.scala rename to tests/init/warn/cold-insert-hot-array.scala index a11d92b2a265..a6c4b4aaebfd 100644 --- a/tests/init/neg/cold-insert-hot-array.scala +++ b/tests/init/warn/cold-insert-hot-array.scala @@ -3,7 +3,7 @@ object A: class B { var a = new Array[B](2) - A.foo(this, a) // error + A.foo(this, a) // warn println(a(0).i) val i = 99 } diff --git a/tests/init/neg/cycle-structure.scala b/tests/init/warn/cycle-structure.scala similarity index 64% rename from tests/init/neg/cycle-structure.scala rename to tests/init/warn/cycle-structure.scala index 1a02a31188b1..f3eb7560f414 100644 --- a/tests/init/neg/cycle-structure.scala +++ b/tests/init/warn/cycle-structure.scala @@ -1,11 +1,11 @@ case class A(b: B) { val x1 = b.x - val x = B(this) // error + val x = B(this) // warn val y = x.a } case class B(a: A) { val x1 = a.x - val x = A(this) // error + val x = A(this) // warn val h = x.b } diff --git a/tests/init/neg/cycle.scala b/tests/init/warn/cycle.scala similarity index 59% rename from tests/init/neg/cycle.scala rename to tests/init/warn/cycle.scala index 7d871795f0a2..f3733df03da4 100644 --- a/tests/init/neg/cycle.scala +++ b/tests/init/warn/cycle.scala @@ -1,11 +1,11 @@ class A(x: B) { println(x.b) - val a = new B(this) // error + val a = new B(this) // warn val d = a.b } class B(x: A) { println(x.a) - val b = new A(this) // error + val b = new A(this) // warn val d = b.a } \ No newline at end of file diff --git a/tests/init/neg/default-this.scala b/tests/init/warn/default-this.scala similarity index 89% rename from tests/init/neg/default-this.scala rename to tests/init/warn/default-this.scala index 1b0173fc134f..26b669bcbd40 100644 --- a/tests/init/neg/default-this.scala +++ b/tests/init/warn/default-this.scala @@ -6,7 +6,7 @@ class A { class B extends A { def updateThenCompare(c: Int): Boolean = { x = c - compare() // error + compare() // warn } val result = updateThenCompare(5) } diff --git a/tests/init/neg/early-promote.scala b/tests/init/warn/early-promote.scala similarity index 84% rename from tests/init/neg/early-promote.scala rename to tests/init/warn/early-promote.scala index fd226df347fb..1cd608d3f63b 100644 --- a/tests/init/neg/early-promote.scala +++ b/tests/init/warn/early-promote.scala @@ -24,7 +24,7 @@ class A { // checking A def c = new C } val b = new B() - println(b) // error: the checker simply issue warnings for objects that contain inner classes + println(b) // warn: the checker simply issue warnings for objects that contain inner classes val af = 42 } diff --git a/tests/init/warn/early-promote2.scala b/tests/init/warn/early-promote2.scala new file mode 100644 index 000000000000..8326aa851e21 --- /dev/null +++ b/tests/init/warn/early-promote2.scala @@ -0,0 +1,6 @@ +class M { + println(this) // warn + foo() + private val a = 5 // warn + def foo() = a +} diff --git a/tests/init/neg/early-promote3.scala b/tests/init/warn/early-promote3.scala similarity index 77% rename from tests/init/neg/early-promote3.scala rename to tests/init/warn/early-promote3.scala index ecb5bbedca69..a81b261d78ba 100644 --- a/tests/init/neg/early-promote3.scala +++ b/tests/init/warn/early-promote3.scala @@ -6,6 +6,6 @@ abstract class A { } class M extends A { - def bar() = promote(this) // error + def bar() = promote(this) // warn def promote(m: M) = m.foo() } diff --git a/tests/init/neg/early-promote4.scala b/tests/init/warn/early-promote4.scala similarity index 87% rename from tests/init/neg/early-promote4.scala rename to tests/init/warn/early-promote4.scala index 487a75c5516f..9d215b308200 100644 --- a/tests/init/neg/early-promote4.scala +++ b/tests/init/warn/early-promote4.scala @@ -16,5 +16,5 @@ class Outer { class Dummy { val m: Int = n + 4 - val n: Int = 10 // error + val n: Int = 10 // warn } diff --git a/tests/init/neg/early-promote5.scala b/tests/init/warn/early-promote5.scala similarity index 80% rename from tests/init/neg/early-promote5.scala rename to tests/init/warn/early-promote5.scala index 3f850b623ea3..bbcc63527fdf 100644 --- a/tests/init/neg/early-promote5.scala +++ b/tests/init/warn/early-promote5.scala @@ -14,11 +14,11 @@ class Outer { class Container { val o = new Outer - val m = new o.M(this) // error + val m = new o.M(this) // warn val s = "hello" } class Dummy { val m: Int = n + 4 - val n: Int = 10 // error + val n: Int = 10 // warn } diff --git a/tests/init/neg/escape1.scala b/tests/init/warn/escape1.scala similarity index 71% rename from tests/init/neg/escape1.scala rename to tests/init/warn/escape1.scala index 588f0933cfc3..ff0cb4ea3816 100644 --- a/tests/init/neg/escape1.scala +++ b/tests/init/warn/escape1.scala @@ -1,5 +1,5 @@ class Foo { - val a = Foo.bar(this) // error + val a = Foo.bar(this) // warn val b = "hello" } diff --git a/tests/init/neg/features-high-order.scala b/tests/init/warn/features-high-order.scala similarity index 81% rename from tests/init/neg/features-high-order.scala rename to tests/init/warn/features-high-order.scala index 60c15545cc14..6f758aeb6785 100644 --- a/tests/init/neg/features-high-order.scala +++ b/tests/init/warn/features-high-order.scala @@ -4,6 +4,6 @@ abstract class Parent { } class Child extends Parent { val a = f() - val b = "hello" // error + val b = "hello" // warn def message: String = b } diff --git a/tests/init/neg/features-linearization.scala b/tests/init/warn/features-linearization.scala similarity index 82% rename from tests/init/neg/features-linearization.scala rename to tests/init/warn/features-linearization.scala index 77d6a231d79a..d3c7b7b0db47 100644 --- a/tests/init/neg/features-linearization.scala +++ b/tests/init/warn/features-linearization.scala @@ -1,5 +1,5 @@ trait TA { - val x = "world" // error + val x = "world" // warn } trait TB { diff --git a/tests/init/neg/features-trees.scala b/tests/init/warn/features-trees.scala similarity index 76% rename from tests/init/neg/features-trees.scala rename to tests/init/warn/features-trees.scala index 867e6636bb12..32026785b3e5 100644 --- a/tests/init/neg/features-trees.scala +++ b/tests/init/warn/features-trees.scala @@ -2,5 +2,5 @@ class Trees { class ValDef { counter += 1 } class EmptyValDef extends ValDef val theEmptyValDef = new EmptyValDef - private var counter = 0 // error + private var counter = 0 // warn } diff --git a/tests/init/neg/final-fields.scala b/tests/init/warn/final-fields.scala similarity index 72% rename from tests/init/neg/final-fields.scala rename to tests/init/warn/final-fields.scala index 174ee9eeb79d..7d9d6280be70 100644 --- a/tests/init/neg/final-fields.scala +++ b/tests/init/warn/final-fields.scala @@ -29,10 +29,10 @@ object Test1 extends U { } object Test extends T { - override final val f1 = /*super.f1*/ 1 + f2 // error - override final val f2 = 2 // error - override final val f3 = {println(3); 3} // error - override val f4 = f3 + 1 // error + override final val f1 = /*super.f1*/ 1 + f2 // warn + override final val f2 = 2 // warn + override final val f3 = {println(3); 3} // warn + override val f4 = f3 + 1 // warn def g: 3 = { println("g"); 3 } final val x = g + 1 diff --git a/tests/init/neg/flow2.scala b/tests/init/warn/flow2.scala similarity index 73% rename from tests/init/neg/flow2.scala rename to tests/init/warn/flow2.scala index a0c5f89601ee..3bb4fa110e50 100644 --- a/tests/init/neg/flow2.scala +++ b/tests/init/warn/flow2.scala @@ -1,6 +1,6 @@ class Foo { val len = list.size - val list = List(4, 6) // error + val list = List(4, 6) // warn lazy val len2 = list2.size // ok val list2 = List(4, 6) diff --git a/tests/init/neg/function-loop.scala b/tests/init/warn/function-loop.scala similarity index 78% rename from tests/init/neg/function-loop.scala rename to tests/init/warn/function-loop.scala index 12048860c3a6..981e8f8215c5 100644 --- a/tests/init/neg/function-loop.scala +++ b/tests/init/warn/function-loop.scala @@ -2,5 +2,5 @@ class Foo { val f: Int => Foo = (x: Int) => if x > 0 then f(x) else this f(10).n - val n = 10 // error + val n = 10 // warn } \ No newline at end of file diff --git a/tests/init/neg/function1.scala b/tests/init/warn/function1.scala similarity index 60% rename from tests/init/neg/function1.scala rename to tests/init/warn/function1.scala index 15427f3de750..29a139b39bd2 100644 --- a/tests/init/neg/function1.scala +++ b/tests/init/warn/function1.scala @@ -4,9 +4,9 @@ class Foo { val fun2: Int => Int = n => 1 + n + list.size fun2(5) - List(5, 9).map(n => 2 + n + list.size) // error + List(5, 9).map(n => 2 + n + list.size) // warn - final val list = List(1, 2, 3) // error + final val list = List(1, 2, 3) // warn List(5, 9).map(n => 3 + n + list.size) } \ No newline at end of file diff --git a/tests/init/neg/function10.scala b/tests/init/warn/function10.scala similarity index 53% rename from tests/init/neg/function10.scala rename to tests/init/warn/function10.scala index 3d8a72aaa1ea..22260bb5d622 100644 --- a/tests/init/neg/function10.scala +++ b/tests/init/warn/function10.scala @@ -1,5 +1,5 @@ class Base { self => - (0 to 10).foreach { i => // error + (0 to 10).foreach { i => // warn println(a) } diff --git a/tests/init/neg/function11.scala b/tests/init/warn/function11.scala similarity index 89% rename from tests/init/neg/function11.scala rename to tests/init/warn/function11.scala index cb6626291214..877a295ac3ec 100644 --- a/tests/init/neg/function11.scala +++ b/tests/init/warn/function11.scala @@ -1,7 +1,7 @@ final class Capture { private[this] var m: Boolean = false - (0 to 10).foreach { i => // error + (0 to 10).foreach { i => // warn f() } diff --git a/tests/init/neg/function2.scala b/tests/init/warn/function2.scala similarity index 70% rename from tests/init/neg/function2.scala rename to tests/init/warn/function2.scala index 0a0f44e2744e..045eb8f4289e 100644 --- a/tests/init/neg/function2.scala +++ b/tests/init/warn/function2.scala @@ -2,5 +2,5 @@ final class Foo { def fun: Int => Int = n => n + x.size fun(5) - val x = "hello" // error + val x = "hello" // warn } \ No newline at end of file diff --git a/tests/init/neg/hybrid1.scala b/tests/init/warn/hybrid1.scala similarity index 87% rename from tests/init/neg/hybrid1.scala rename to tests/init/warn/hybrid1.scala index 94c7a43bfbcd..f1a4665954c9 100644 --- a/tests/init/neg/hybrid1.scala +++ b/tests/init/warn/hybrid1.scala @@ -17,5 +17,5 @@ class Y { new C - val n = 10 // error + val n = 10 // warn } diff --git a/tests/init/neg/hybrid2.scala b/tests/init/warn/hybrid2.scala similarity index 84% rename from tests/init/neg/hybrid2.scala rename to tests/init/warn/hybrid2.scala index a9f8246fd58d..6d901d810a64 100644 --- a/tests/init/neg/hybrid2.scala +++ b/tests/init/warn/hybrid2.scala @@ -15,5 +15,5 @@ class Y { val x = new X x.b.g - val n = 10 // error + val n = 10 // warn } diff --git a/tests/init/neg/hybrid4.scala b/tests/init/warn/hybrid4.scala similarity index 75% rename from tests/init/neg/hybrid4.scala rename to tests/init/warn/hybrid4.scala index 6243fbf2d5f4..8237d0e8244a 100644 --- a/tests/init/neg/hybrid4.scala +++ b/tests/init/warn/hybrid4.scala @@ -8,5 +8,5 @@ class Foo { } val bar: Bar = new Bar - val list = List(1, 2, 3) // error + val list = List(1, 2, 3) // warn } diff --git a/tests/init/neg/hybrid5.scala b/tests/init/warn/hybrid5.scala similarity index 86% rename from tests/init/neg/hybrid5.scala rename to tests/init/warn/hybrid5.scala index 54c781b8835d..4f7f5baad771 100644 --- a/tests/init/neg/hybrid5.scala +++ b/tests/init/warn/hybrid5.scala @@ -15,5 +15,5 @@ class Foo { def g = new Foo.this.Inner } - val list = List(1, 2, 3) // error + val list = List(1, 2, 3) // warn } diff --git a/tests/init/neg/hybrid6.scala b/tests/init/warn/hybrid6.scala similarity index 81% rename from tests/init/neg/hybrid6.scala rename to tests/init/warn/hybrid6.scala index bbecc16942e5..58cbaa76979f 100644 --- a/tests/init/neg/hybrid6.scala +++ b/tests/init/warn/hybrid6.scala @@ -11,5 +11,5 @@ class Foo { def g = list } - val list = List(1, 2, 3) // error + val list = List(1, 2, 3) // warn } diff --git a/tests/init/neg/i10549b.scala b/tests/init/warn/i10549b.scala similarity index 81% rename from tests/init/neg/i10549b.scala rename to tests/init/warn/i10549b.scala index 7353844b3927..b0dd305c7e27 100644 --- a/tests/init/neg/i10549b.scala +++ b/tests/init/warn/i10549b.scala @@ -4,6 +4,6 @@ class Wrap { abstract class E[+T] { def foo: T } object E { final val A: E[Nothing] = new E { def foo = ref } - val ref = qux(A) // error + val ref = qux(A) // warn } } diff --git a/tests/init/neg/i11572.scala b/tests/init/warn/i11572.scala similarity index 90% rename from tests/init/neg/i11572.scala rename to tests/init/warn/i11572.scala index 59fa3c1fbc43..2a32a8bdd540 100644 --- a/tests/init/neg/i11572.scala +++ b/tests/init/warn/i11572.scala @@ -5,7 +5,7 @@ class A { trait Bounded { type T >: Cov[Int] <: Cov[String] } - val t: Bounded = new Bounded { // error + val t: Bounded = new Bounded { // warn // Note: using this instead of t produces an error (as expected) override type T >: t.T <: t.T } diff --git a/tests/init/neg/i12544.scala b/tests/init/warn/i12544.scala similarity index 86% rename from tests/init/neg/i12544.scala rename to tests/init/warn/i12544.scala index 2692c27134e0..4856f653a912 100644 --- a/tests/init/neg/i12544.scala +++ b/tests/init/warn/i12544.scala @@ -13,7 +13,7 @@ object Enum: def f(e: Enum): Enum = e class B() { def foo() = n + 1 } - g(new B()) // error + g(new B()) // warn val n: Int = 10 @main def main(): Unit = println(Enum.b) diff --git a/tests/init/neg/i15363.scala b/tests/init/warn/i15363.scala similarity index 78% rename from tests/init/neg/i15363.scala rename to tests/init/warn/i15363.scala index 01a2bdfcf530..87ca08ea916e 100644 --- a/tests/init/neg/i15363.scala +++ b/tests/init/warn/i15363.scala @@ -1,6 +1,6 @@ class A: // should report one error here - val b = new B(this) // error + val b = new B(this) // warn val m = 10 val n = 20 diff --git a/tests/init/neg/i15459.scala b/tests/init/warn/i15459.scala similarity index 81% rename from tests/init/neg/i15459.scala rename to tests/init/warn/i15459.scala index 4d54f31f7af8..72779ef0c7c1 100644 --- a/tests/init/neg/i15459.scala +++ b/tests/init/warn/i15459.scala @@ -1,6 +1,6 @@ class Sup: val a = 10 - println(this) // error + println(this) // warn class Sub extends Sup: val b = 20 diff --git a/tests/init/warn/i15883.scala b/tests/init/warn/i15883.scala new file mode 100644 index 000000000000..71c46494dbac --- /dev/null +++ b/tests/init/warn/i15883.scala @@ -0,0 +1,2 @@ +val a = b +val b = 1 // warn diff --git a/tests/init/neg/i4031.scala b/tests/init/warn/i4031.scala similarity index 78% rename from tests/init/neg/i4031.scala rename to tests/init/warn/i4031.scala index 8340296340e7..d43ea244b65d 100644 --- a/tests/init/neg/i4031.scala +++ b/tests/init/warn/i4031.scala @@ -1,7 +1,7 @@ object App { trait A { type L >: Any} def upcast(a: A, x: Any): a.L = x - val p: A { type L <: Nothing } = p // error + val p: A { type L <: Nothing } = p // warn def coerce(x: Any): Int = upcast(p, x) def main(args: Array[String]): Unit = { diff --git a/tests/init/neg/i4042.scala b/tests/init/warn/i4042.scala similarity index 87% rename from tests/init/neg/i4042.scala rename to tests/init/warn/i4042.scala index 58c884a5690d..284f97a352c9 100644 --- a/tests/init/neg/i4042.scala +++ b/tests/init/warn/i4042.scala @@ -5,7 +5,7 @@ object App { class T[A <: X](val a: A)(val value: a.R) - object O { val x : Y & X = x } // error + object O { val x : Y & X = x } // warn val a = new T[Y & X](O.x)(u) a.value diff --git a/tests/init/neg/i50.scala b/tests/init/warn/i50.scala similarity index 64% rename from tests/init/neg/i50.scala rename to tests/init/warn/i50.scala index 9131fb263f48..7c860bc007fa 100644 --- a/tests/init/neg/i50.scala +++ b/tests/init/warn/i50.scala @@ -1,5 +1,5 @@ class C[T] { val a: T = method def method = b - val b: T = a // error + val b: T = a // warn } \ No newline at end of file diff --git a/tests/init/neg/i5854.scala b/tests/init/warn/i5854.scala similarity index 63% rename from tests/init/neg/i5854.scala rename to tests/init/warn/i5854.scala index 05fa1033dd2c..60060394bdcd 100644 --- a/tests/init/neg/i5854.scala +++ b/tests/init/warn/i5854.scala @@ -1,5 +1,5 @@ class B { val a: String = (((1: Any): b.A): Nothing): String - val b: { type A >: Any <: Nothing } = loop() // error + val b: { type A >: Any <: Nothing } = loop() // warn def loop(): Nothing = loop() } diff --git a/tests/init/neg/inherit-non-hot.scala b/tests/init/warn/inherit-non-hot.scala similarity index 86% rename from tests/init/neg/inherit-non-hot.scala rename to tests/init/warn/inherit-non-hot.scala index 44be67351630..28520ea9c621 100644 --- a/tests/init/neg/inherit-non-hot.scala +++ b/tests/init/warn/inherit-non-hot.scala @@ -3,7 +3,7 @@ object Foo { abstract class A { var b: B = null def toB: B = - if b == null then b = new B(this) // error + if b == null then b = new B(this) // warn b } diff --git a/tests/init/neg/inlined-method.scala b/tests/init/warn/inlined-method.scala similarity index 70% rename from tests/init/neg/inlined-method.scala rename to tests/init/warn/inlined-method.scala index 4af473837f0f..e6ea86ba33c9 100644 --- a/tests/init/neg/inlined-method.scala +++ b/tests/init/warn/inlined-method.scala @@ -5,4 +5,4 @@ class InlineError { object Assertion: transparent inline def failAssert(inline message: => Any): Unit = - scala.runtime.Scala3RunTime.assertFailed(message) // error \ No newline at end of file + scala.runtime.Scala3RunTime.assertFailed(message) // warn \ No newline at end of file diff --git a/tests/init/neg/inner-case.scala b/tests/init/warn/inner-case.scala similarity index 82% rename from tests/init/neg/inner-case.scala rename to tests/init/warn/inner-case.scala index 20a9b1d2684f..317d77376aa9 100644 --- a/tests/init/neg/inner-case.scala +++ b/tests/init/warn/inner-case.scala @@ -4,7 +4,7 @@ class Foo { } val a = Inner(5) // ok - println(a) // error + println(a) // warn var count = 0 println(a) // ok diff --git a/tests/init/neg/inner-first.scala b/tests/init/warn/inner-first.scala similarity index 69% rename from tests/init/neg/inner-first.scala rename to tests/init/warn/inner-first.scala index cd7b28a30b62..be3c7d824dc5 100644 --- a/tests/init/neg/inner-first.scala +++ b/tests/init/warn/inner-first.scala @@ -1,6 +1,6 @@ class A: class B: - println(this) // error + println(this) // warn val n = 10 def foo() = println(m) new B diff --git a/tests/init/neg/inner-loop.scala b/tests/init/warn/inner-loop.scala similarity index 88% rename from tests/init/neg/inner-loop.scala rename to tests/init/warn/inner-loop.scala index c6d5c615580c..8b63eb9507dc 100644 --- a/tests/init/neg/inner-loop.scala +++ b/tests/init/warn/inner-loop.scala @@ -3,7 +3,7 @@ class Outer { outer => val x = 5 + outer.n } val inner = new Inner - val n = 6 // error + val n = 6 // warn } class Outer2 { outer => @@ -28,7 +28,7 @@ class Test { // If we change policy to check more eagerly, // the check has to avoid loop here. - println(outer) // error + println(outer) // warn val m = 10 } \ No newline at end of file diff --git a/tests/init/neg/inner-new.scala b/tests/init/warn/inner-new.scala similarity index 80% rename from tests/init/neg/inner-new.scala rename to tests/init/warn/inner-new.scala index d09dc5193dbf..2ecaf5e544e1 100644 --- a/tests/init/neg/inner-new.scala +++ b/tests/init/warn/inner-new.scala @@ -4,7 +4,7 @@ class Foo { } val a = new Inner // ok - println(a) // error + println(a) // warn var count = 0 println(a) // ok diff --git a/tests/init/neg/inner-pat_iuli.scala b/tests/init/warn/inner-pat_iuli.scala similarity index 92% rename from tests/init/neg/inner-pat_iuli.scala rename to tests/init/warn/inner-pat_iuli.scala index e5010cca98ec..bd84fee43d97 100644 --- a/tests/init/neg/inner-pat_iuli.scala +++ b/tests/init/warn/inner-pat_iuli.scala @@ -20,5 +20,5 @@ trait Blox { self: MyCodes => class MyCodes extends AnyRef with Ops with Blox { val a = b - val b: Int = 10 // error + val b: Int = 10 // warn } diff --git a/tests/init/neg/inner1.scala b/tests/init/warn/inner1.scala similarity index 80% rename from tests/init/neg/inner1.scala rename to tests/init/warn/inner1.scala index d39c3ba2ac77..9220eda882cf 100644 --- a/tests/init/neg/inner1.scala +++ b/tests/init/warn/inner1.scala @@ -1,7 +1,7 @@ class Foo { new this.Inner - val list = List(1, 2, 3) // error, as Inner access `this.list` + val list = List(1, 2, 3) // warn, as Inner access `this.list` val inner: Inner = new this.Inner // ok, `list` is instantiated lib.escape(inner) // ok, can promote inner early diff --git a/tests/init/neg/inner11.scala b/tests/init/warn/inner11.scala similarity index 93% rename from tests/init/neg/inner11.scala rename to tests/init/warn/inner11.scala index 04098be8a3fd..2ea6d25f5d6f 100644 --- a/tests/init/neg/inner11.scala +++ b/tests/init/warn/inner11.scala @@ -12,7 +12,7 @@ object NameKinds { class ClassifiedNameKind(tag: Int, val infoString: String) extends NameKind(tag) { type ThisInfo = Info val info: Info = new Info - println(info.kind) // error + println(info.kind) // warn val n = 10 } } diff --git a/tests/init/neg/inner15.scala b/tests/init/warn/inner15.scala similarity index 84% rename from tests/init/neg/inner15.scala rename to tests/init/warn/inner15.scala index 59d1daac404f..7c01cd8275d7 100644 --- a/tests/init/neg/inner15.scala +++ b/tests/init/warn/inner15.scala @@ -15,5 +15,5 @@ class B extends A { new Inner1 new Inner2 - override val x = "world" // error + override val x = "world" // warn } \ No newline at end of file diff --git a/tests/init/neg/inner16.scala b/tests/init/warn/inner16.scala similarity index 87% rename from tests/init/neg/inner16.scala rename to tests/init/warn/inner16.scala index 61271396a074..c49cba8a88be 100644 --- a/tests/init/neg/inner16.scala +++ b/tests/init/warn/inner16.scala @@ -13,5 +13,5 @@ class A { val inner = new Inner val b = new O.B - val y = 10 // error + val y = 10 // warn } \ No newline at end of file diff --git a/tests/init/neg/inner17.scala b/tests/init/warn/inner17.scala similarity index 78% rename from tests/init/neg/inner17.scala rename to tests/init/warn/inner17.scala index 756278cd5130..4daad38ea36b 100644 --- a/tests/init/neg/inner17.scala +++ b/tests/init/warn/inner17.scala @@ -9,5 +9,5 @@ class A { } class C extends A { - override val f: Int = 20 // error + override val f: Int = 20 // warn } \ No newline at end of file diff --git a/tests/init/neg/inner19.scala b/tests/init/warn/inner19.scala similarity index 79% rename from tests/init/neg/inner19.scala rename to tests/init/warn/inner19.scala index 2e502eddc24c..91cf406dbc6a 100644 --- a/tests/init/neg/inner19.scala +++ b/tests/init/warn/inner19.scala @@ -15,5 +15,5 @@ class A { class B extends A { println((new O.B).f) O.C(4) - override val n = 50 // error because line 16 + override val n = 50 // warn because line 16 } \ No newline at end of file diff --git a/tests/init/neg/inner20.scala b/tests/init/warn/inner20.scala similarity index 84% rename from tests/init/neg/inner20.scala rename to tests/init/warn/inner20.scala index 1553e09eeeb0..2a868f8b88f5 100644 --- a/tests/init/neg/inner20.scala +++ b/tests/init/warn/inner20.scala @@ -14,5 +14,5 @@ class A { class B extends A { val o = new O println((new o.B).f) - override val n = 50 // error + override val n = 50 // warn } \ No newline at end of file diff --git a/tests/init/neg/inner21.scala b/tests/init/warn/inner21.scala similarity index 71% rename from tests/init/neg/inner21.scala rename to tests/init/warn/inner21.scala index c2277163acc3..232de8fbd0cc 100644 --- a/tests/init/neg/inner21.scala +++ b/tests/init/warn/inner21.scala @@ -8,7 +8,7 @@ class X { A.foo A.bar - val name = "jack" // error + val name = "jack" // warn } @@ -22,5 +22,5 @@ class Y { (new A).foo (new A).bar - val name = "jack" // error + val name = "jack" // warn } \ No newline at end of file diff --git a/tests/init/neg/inner22.scala b/tests/init/warn/inner22.scala similarity index 92% rename from tests/init/neg/inner22.scala rename to tests/init/warn/inner22.scala index aa5a381f2d49..055a9d9bed7d 100644 --- a/tests/init/neg/inner22.scala +++ b/tests/init/warn/inner22.scala @@ -28,5 +28,5 @@ class D { new C - val x = 10 // error + val x = 10 // warn } \ No newline at end of file diff --git a/tests/init/neg/inner23.scala b/tests/init/warn/inner23.scala similarity index 77% rename from tests/init/neg/inner23.scala rename to tests/init/warn/inner23.scala index 5d373c649ce2..a5985a8d805c 100644 --- a/tests/init/neg/inner23.scala +++ b/tests/init/warn/inner23.scala @@ -9,5 +9,5 @@ class Trees { } val theEmptyValDef = new EmptyValDef - val name = "hello" // error + val name = "hello" // warn } diff --git a/tests/init/neg/inner24.scala b/tests/init/warn/inner24.scala similarity index 84% rename from tests/init/neg/inner24.scala rename to tests/init/warn/inner24.scala index f8a60c1bb311..3c28546b10cc 100644 --- a/tests/init/neg/inner24.scala +++ b/tests/init/warn/inner24.scala @@ -14,5 +14,5 @@ class Bar extends Foo { val b = new B override def foo(x: Int) = x + id - val id = 100 // error + val id = 100 // warn } \ No newline at end of file diff --git a/tests/init/neg/inner25.scala b/tests/init/warn/inner25.scala similarity index 91% rename from tests/init/neg/inner25.scala rename to tests/init/warn/inner25.scala index 8cf99539b849..a9538dee6462 100644 --- a/tests/init/neg/inner25.scala +++ b/tests/init/warn/inner25.scala @@ -8,7 +8,7 @@ class A[K, V] { self => } } - println(new O) // error + println(new O) // warn val a = 10 } \ No newline at end of file diff --git a/tests/init/neg/inner29.scala b/tests/init/warn/inner29.scala similarity index 83% rename from tests/init/neg/inner29.scala rename to tests/init/warn/inner29.scala index 740352db1e4e..03350a5266b8 100644 --- a/tests/init/neg/inner29.scala +++ b/tests/init/warn/inner29.scala @@ -15,7 +15,7 @@ class C extends B(5) { override def f: Int = x } - val a = new E // error: init too late + val a = new E // warn: init too late val x = 10 } \ No newline at end of file diff --git a/tests/init/neg/inner30.scala b/tests/init/warn/inner30.scala similarity index 93% rename from tests/init/neg/inner30.scala rename to tests/init/warn/inner30.scala index 01bb5754d485..84cc46cbca1a 100644 --- a/tests/init/neg/inner30.scala +++ b/tests/init/warn/inner30.scala @@ -17,5 +17,5 @@ object Scanners { } val m: Int = n * 2 - val n = 10 // error + val n = 10 // warn } \ No newline at end of file diff --git a/tests/init/neg/inner4.scala b/tests/init/warn/inner4.scala similarity index 77% rename from tests/init/neg/inner4.scala rename to tests/init/warn/inner4.scala index 5fc4d2b9e053..66a39da03909 100644 --- a/tests/init/neg/inner4.scala +++ b/tests/init/warn/inner4.scala @@ -6,5 +6,5 @@ class Foo(val foo1: Foo) { new this.Inner new foo1.Inner - val name = "hello" // error + val name = "hello" // warn } diff --git a/tests/init/neg/inner5.scala b/tests/init/warn/inner5.scala similarity index 76% rename from tests/init/neg/inner5.scala rename to tests/init/warn/inner5.scala index 20f4aa1bdaeb..f91573e98cb6 100644 --- a/tests/init/neg/inner5.scala +++ b/tests/init/warn/inner5.scala @@ -4,7 +4,7 @@ class Foo { } new B - val a = 3 // error + val a = 3 // warn def foo(x: Int) = a + x } \ No newline at end of file diff --git a/tests/init/neg/inner6.scala b/tests/init/warn/inner6.scala similarity index 91% rename from tests/init/neg/inner6.scala rename to tests/init/warn/inner6.scala index 42b68fe2d8ea..7f0436dc6924 100644 --- a/tests/init/neg/inner6.scala +++ b/tests/init/warn/inner6.scala @@ -18,6 +18,6 @@ class Child extends Parent { new InnerA new InnerB - val x = 10 // error + val x = 10 // warn override def foo: Int = x * x } diff --git a/tests/init/neg/inner7.scala b/tests/init/warn/inner7.scala similarity index 81% rename from tests/init/neg/inner7.scala rename to tests/init/warn/inner7.scala index bdac38cc31d8..5e0df53f0888 100644 --- a/tests/init/neg/inner7.scala +++ b/tests/init/warn/inner7.scala @@ -11,6 +11,6 @@ class Child extends Parent { class InnerA extends Inner1 new InnerA - override val list = List(4, 5) // error + override val list = List(4, 5) // warn override def foo: Int = list.size } diff --git a/tests/init/neg/inner9.scala b/tests/init/warn/inner9.scala similarity index 83% rename from tests/init/neg/inner9.scala rename to tests/init/warn/inner9.scala index db5198ea0138..a7379ef4b7fe 100644 --- a/tests/init/neg/inner9.scala +++ b/tests/init/warn/inner9.scala @@ -6,7 +6,7 @@ object Flags { new Flags.Inner val a = this.b + 3 - val b = 5 // error + val b = 5 // warn } object Flags2 { diff --git a/tests/init/neg/insert-cold-subtype-to-array.scala b/tests/init/warn/insert-cold-subtype-to-array.scala similarity index 84% rename from tests/init/neg/insert-cold-subtype-to-array.scala rename to tests/init/warn/insert-cold-subtype-to-array.scala index 82eee1935a95..6f4bf9bca73e 100644 --- a/tests/init/neg/insert-cold-subtype-to-array.scala +++ b/tests/init/warn/insert-cold-subtype-to-array.scala @@ -3,6 +3,6 @@ object A: class B: var a = new Array[B](2) - A.foo(this, a) // error + A.foo(this, a) // warn println(a(0).i) val i = 99 \ No newline at end of file diff --git a/tests/init/neg/java1.scala b/tests/init/warn/java1.scala similarity index 91% rename from tests/init/neg/java1.scala rename to tests/init/warn/java1.scala index 1eff09cb6ff1..36044413d2ea 100644 --- a/tests/init/neg/java1.scala +++ b/tests/init/warn/java1.scala @@ -8,4 +8,4 @@ class A extends Spliterator.OfDouble: def tryAdvance(x$0: java.util.function.DoubleConsumer): Boolean = false val m = n + 1 - val n = 10 // error + val n = 10 // warn diff --git a/tests/init/neg/lazy.scala b/tests/init/warn/lazy.scala similarity index 69% rename from tests/init/neg/lazy.scala rename to tests/init/warn/lazy.scala index 0f3047bc0d1b..a895714b0f9a 100644 --- a/tests/init/neg/lazy.scala +++ b/tests/init/warn/lazy.scala @@ -1,11 +1,11 @@ class Foo { val len = list.size - val list = List(4, 6) // error + val list = List(4, 6) // warn lazy val len2 = list2.size // ok val list2 = List(4, 6) lazy val len3 = name.size val len4 = len3 + 4 - val name = "hello" // error + val name = "hello" // warn } diff --git a/tests/init/neg/lazylist2.scala b/tests/init/warn/lazylist2.scala similarity index 89% rename from tests/init/neg/lazylist2.scala rename to tests/init/warn/lazylist2.scala index 18072676fa4c..618364f49a98 100644 --- a/tests/init/neg/lazylist2.scala +++ b/tests/init/warn/lazylist2.scala @@ -26,7 +26,7 @@ final class Test1 { a.head // ok b.head // ok - val x: LazyList[Int] = 5 #:: y // error + val x: LazyList[Int] = 5 #:: y // warn val y: LazyList[Int] = 10 #:: x } @@ -37,7 +37,7 @@ final class Test2 { } final class Test3 { - val a: LazyList[Int] = n #:: (a: @unchecked) // error + val a: LazyList[Int] = n #:: (a: @unchecked) // warn a.head val n: Int = 20 } \ No newline at end of file diff --git a/tests/init/neg/leak-warm.scala b/tests/init/warn/leak-warm.scala similarity index 91% rename from tests/init/neg/leak-warm.scala rename to tests/init/warn/leak-warm.scala index bc5539ce9c0b..712a4e5fed69 100644 --- a/tests/init/neg/leak-warm.scala +++ b/tests/init/warn/leak-warm.scala @@ -16,5 +16,5 @@ object leakWarm { val c = new C(1, 2) val d = new D(3, 4) val l: List[A] = List(c, d) - val l2 = l.map(_.m()) // error + val l2 = l.map(_.m()) // warn } diff --git a/tests/init/neg/local-class.scala b/tests/init/warn/local-class.scala similarity index 84% rename from tests/init/neg/local-class.scala rename to tests/init/warn/local-class.scala index 20e77912dce8..14f203a738c3 100644 --- a/tests/init/neg/local-class.scala +++ b/tests/init/warn/local-class.scala @@ -12,5 +12,5 @@ class Outer { foo - val n = 10 // error + val n = 10 // warn } diff --git a/tests/init/neg/override1.scala b/tests/init/warn/override1.scala similarity index 84% rename from tests/init/neg/override1.scala rename to tests/init/warn/override1.scala index c9c9fed3ecd8..b247470c19d5 100644 --- a/tests/init/neg/override1.scala +++ b/tests/init/warn/override1.scala @@ -15,6 +15,6 @@ class Qux(x: Int) extends Bar { } class Yun extends Bar { - override val x: Int = 10 // error + override val x: Int = 10 // warn def foo(n: Int) = x + n } diff --git a/tests/init/neg/override10.scala b/tests/init/warn/override10.scala similarity index 75% rename from tests/init/neg/override10.scala rename to tests/init/warn/override10.scala index 6b8b0e7101db..0c49d7c63113 100644 --- a/tests/init/neg/override10.scala +++ b/tests/init/warn/override10.scala @@ -5,5 +5,5 @@ trait Foo { class Bar extends Foo { f() - val message = "hello" // error + val message = "hello" // warn } \ No newline at end of file diff --git a/tests/init/neg/override14.scala b/tests/init/warn/override14.scala similarity index 76% rename from tests/init/neg/override14.scala rename to tests/init/warn/override14.scala index 451a12087103..0d773e61f9b2 100644 --- a/tests/init/neg/override14.scala +++ b/tests/init/warn/override14.scala @@ -1,5 +1,5 @@ abstract class A { - val x = f(this) // error + val x = f(this) // warn val y = 10 def f(a: A): Int diff --git a/tests/init/neg/override15.scala b/tests/init/warn/override15.scala similarity index 81% rename from tests/init/neg/override15.scala rename to tests/init/warn/override15.scala index 0f22430cf6a6..ca3e32abb35e 100644 --- a/tests/init/neg/override15.scala +++ b/tests/init/warn/override15.scala @@ -1,6 +1,6 @@ abstract class A { val g = (n: Int) => n + y - val x: Int = f(g) // error + val x: Int = f(g) // warn val y: Int = 10 def f(m: Int => Int): Int diff --git a/tests/init/neg/override17.scala b/tests/init/warn/override17.scala similarity index 76% rename from tests/init/neg/override17.scala rename to tests/init/warn/override17.scala index 72bd8db9a246..cbeaaed37bea 100644 --- a/tests/init/neg/override17.scala +++ b/tests/init/warn/override17.scala @@ -3,7 +3,7 @@ class A { self : B => } trait B { - val x = 10 // error + val x = 10 // warn } class C extends A with B diff --git a/tests/init/neg/override18.scala b/tests/init/warn/override18.scala similarity index 88% rename from tests/init/neg/override18.scala rename to tests/init/warn/override18.scala index 61edaf6d8c8f..3c2ca3e7af5d 100644 --- a/tests/init/neg/override18.scala +++ b/tests/init/warn/override18.scala @@ -10,7 +10,7 @@ class B extends A { class C extends A { val x = f - val y = x // error + val y = x // warn def f: Int = y } diff --git a/tests/init/neg/override19.scala b/tests/init/warn/override19.scala similarity index 79% rename from tests/init/neg/override19.scala rename to tests/init/warn/override19.scala index 8e1f6a832323..61d17bb93597 100644 --- a/tests/init/neg/override19.scala +++ b/tests/init/warn/override19.scala @@ -5,6 +5,6 @@ abstract class A extends Product { case class B(x: Int, y: String) extends A case class C(x: Int) extends A { - val y = 10 // error + val y = 10 // warn def productArity: Int = y } \ No newline at end of file diff --git a/tests/init/neg/override2.scala b/tests/init/warn/override2.scala similarity index 89% rename from tests/init/neg/override2.scala rename to tests/init/warn/override2.scala index f9964f60ad29..3adae93c23c9 100644 --- a/tests/init/neg/override2.scala +++ b/tests/init/warn/override2.scala @@ -8,7 +8,7 @@ trait Foo { } class Bar extends Foo { - val y = "hello" // error + val y = "hello" // warn foo(5) bar(10) diff --git a/tests/init/neg/override20.scala b/tests/init/warn/override20.scala similarity index 75% rename from tests/init/neg/override20.scala rename to tests/init/warn/override20.scala index 65ece64c6020..4f1f7b452f75 100644 --- a/tests/init/neg/override20.scala +++ b/tests/init/warn/override20.scala @@ -2,7 +2,7 @@ class A { self : B => val y = f } -trait B(x: Int) { // error +trait B(x: Int) { // warn def f: Int = x } diff --git a/tests/init/neg/override21.scala b/tests/init/warn/override21.scala similarity index 86% rename from tests/init/neg/override21.scala rename to tests/init/warn/override21.scala index 332ce702a9fc..84c319949cb7 100644 --- a/tests/init/neg/override21.scala +++ b/tests/init/warn/override21.scala @@ -10,7 +10,7 @@ class Child extends Parent { this.z val m = this.x - val y = "hello" // error + val y = "hello" // warn def bar = y.size } \ No newline at end of file diff --git a/tests/init/neg/override22.scala b/tests/init/warn/override22.scala similarity index 87% rename from tests/init/neg/override22.scala rename to tests/init/warn/override22.scala index 7de6f03aa837..f7fc1b312e4e 100644 --- a/tests/init/neg/override22.scala +++ b/tests/init/warn/override22.scala @@ -9,7 +9,7 @@ class Child extends Parent { val y = "hello" this.foo - val m = this.x // error + val m = this.x // warn this.z def bar = m.size + 6 diff --git a/tests/init/neg/override23.scala b/tests/init/warn/override23.scala similarity index 87% rename from tests/init/neg/override23.scala rename to tests/init/warn/override23.scala index 3ada767bfafc..2af45c953ae5 100644 --- a/tests/init/neg/override23.scala +++ b/tests/init/warn/override23.scala @@ -10,7 +10,7 @@ class Child(o: String) extends Parent(o) { this.foo this.z - val y = "hello" // error + val y = "hello" // warn def bar = y.size } \ No newline at end of file diff --git a/tests/init/neg/override24.scala b/tests/init/warn/override24.scala similarity index 91% rename from tests/init/neg/override24.scala rename to tests/init/warn/override24.scala index 9adfac27bb02..feaa07396755 100644 --- a/tests/init/neg/override24.scala +++ b/tests/init/warn/override24.scala @@ -15,7 +15,7 @@ class Bar extends Foo { foo(4) - val name = "bar" // error + val name = "bar" // warn foo(4) } \ No newline at end of file diff --git a/tests/init/neg/override25.scala b/tests/init/warn/override25.scala similarity index 85% rename from tests/init/neg/override25.scala rename to tests/init/warn/override25.scala index 9554b4296a9f..e5d5d7f8e34f 100644 --- a/tests/init/neg/override25.scala +++ b/tests/init/warn/override25.scala @@ -1,4 +1,4 @@ -trait Foo(x: Int) { // error +trait Foo(x: Int) { // warn def name: String = "hello" def f: Int = x diff --git a/tests/init/neg/override26.scala b/tests/init/warn/override26.scala similarity index 85% rename from tests/init/neg/override26.scala rename to tests/init/warn/override26.scala index 37e83898bfcc..98a30477ee74 100644 --- a/tests/init/neg/override26.scala +++ b/tests/init/warn/override26.scala @@ -11,6 +11,6 @@ trait Bar { this: Foo => } class Qux extends Foo with Bar { - val x = "hello" // error + val x = "hello" // warn def title = x } diff --git a/tests/init/neg/override27.scala b/tests/init/warn/override27.scala similarity index 73% rename from tests/init/neg/override27.scala rename to tests/init/warn/override27.scala index 4b3a79ac233b..ae9ffe6ad63f 100644 --- a/tests/init/neg/override27.scala +++ b/tests/init/warn/override27.scala @@ -1,6 +1,6 @@ abstract class Base { def f: Int - val a = f // error + val a = f // warn } class Derived extends Base { @@ -10,7 +10,7 @@ class Derived extends Base { } class Derived2 extends Base { - val b = 30 // error + val b = 30 // warn def f = g def g: Int = b + a diff --git a/tests/init/neg/override28.scala b/tests/init/warn/override28.scala similarity index 72% rename from tests/init/neg/override28.scala rename to tests/init/warn/override28.scala index 8e77f8acb3ba..60ba0bff6c76 100644 --- a/tests/init/neg/override28.scala +++ b/tests/init/warn/override28.scala @@ -6,5 +6,5 @@ abstract class Base(val x: Int) { class C(x: Int) extends Base(x) { - val d = f // error + val d = f // warn } \ No newline at end of file diff --git a/tests/init/neg/override29.scala b/tests/init/warn/override29.scala similarity index 78% rename from tests/init/neg/override29.scala rename to tests/init/warn/override29.scala index e0070eb10218..5c640e2fcc0e 100644 --- a/tests/init/neg/override29.scala +++ b/tests/init/warn/override29.scala @@ -1,5 +1,5 @@ trait A { - var a = 20 // error + var a = 20 // warn def f: Int = a } diff --git a/tests/init/neg/override3.scala b/tests/init/warn/override3.scala similarity index 91% rename from tests/init/neg/override3.scala rename to tests/init/warn/override3.scala index 51759320e1b5..74fae84a547a 100644 --- a/tests/init/neg/override3.scala +++ b/tests/init/warn/override3.scala @@ -13,7 +13,7 @@ class Bar1 extends Foo { } class Qux extends Bar1 { - val u = "hello" // error + val u = "hello" // warn override def foo(n: Int) = u + "world" } diff --git a/tests/init/neg/override30.scala b/tests/init/warn/override30.scala similarity index 79% rename from tests/init/neg/override30.scala rename to tests/init/warn/override30.scala index adb4c2e00d2b..1677574130d4 100644 --- a/tests/init/neg/override30.scala +++ b/tests/init/warn/override30.scala @@ -10,6 +10,6 @@ class Bar extends Foo { } class Qux extends Bar { - val a = 30 // error + val a = 30 // warn override def f = a } \ No newline at end of file diff --git a/tests/init/neg/override31.scala b/tests/init/warn/override31.scala similarity index 84% rename from tests/init/neg/override31.scala rename to tests/init/warn/override31.scala index d902f4a6dc54..baffab3ad08e 100644 --- a/tests/init/neg/override31.scala +++ b/tests/init/warn/override31.scala @@ -11,5 +11,5 @@ class Bar extends Foo { class Qux extends Bar { init override def f = a - private val a = 30 // error + private val a = 30 // warn } \ No newline at end of file diff --git a/tests/init/neg/override32.scala b/tests/init/warn/override32.scala similarity index 80% rename from tests/init/neg/override32.scala rename to tests/init/warn/override32.scala index 09970a9bd392..b9a4e7eae178 100644 --- a/tests/init/neg/override32.scala +++ b/tests/init/warn/override32.scala @@ -6,7 +6,7 @@ trait Foo { } trait Bar { - final val m: String = "hello" // error + final val m: String = "hello" // warn def foo(n: Int) = m } diff --git a/tests/init/neg/override33.scala b/tests/init/warn/override33.scala similarity index 85% rename from tests/init/neg/override33.scala rename to tests/init/warn/override33.scala index b093dc570f04..04d27be6777c 100644 --- a/tests/init/neg/override33.scala +++ b/tests/init/warn/override33.scala @@ -8,7 +8,7 @@ abstract class Foo { } trait Bar { - val name: String = "Foo" // error + val name: String = "Foo" // warn def title: String = name } diff --git a/tests/init/neg/override34.scala b/tests/init/warn/override34.scala similarity index 79% rename from tests/init/neg/override34.scala rename to tests/init/warn/override34.scala index 6cf3e3cf4b4d..e4a21e861eb2 100644 --- a/tests/init/neg/override34.scala +++ b/tests/init/warn/override34.scala @@ -5,7 +5,7 @@ abstract class Foo { } trait Bar { - val name: String = "Foo" // error + val name: String = "Foo" // warn } class Qux extends Foo with Bar { diff --git a/tests/init/neg/override35.scala b/tests/init/warn/override35.scala similarity index 77% rename from tests/init/neg/override35.scala rename to tests/init/warn/override35.scala index 958ed1ff9d2f..1769f7b3a361 100644 --- a/tests/init/neg/override35.scala +++ b/tests/init/warn/override35.scala @@ -10,6 +10,6 @@ trait Bar { } class Qux extends Foo with Bar { - private val x = 30 // error + private val x = 30 // warn override def f = x } \ No newline at end of file diff --git a/tests/init/neg/override36.scala b/tests/init/warn/override36.scala similarity index 87% rename from tests/init/neg/override36.scala rename to tests/init/warn/override36.scala index 6df0891d5b27..2fedf7ff6bcb 100644 --- a/tests/init/neg/override36.scala +++ b/tests/init/warn/override36.scala @@ -14,5 +14,5 @@ class Bar extends Foo { class Qux extends Bar { init override def h = a - private val a = 30 // error + private val a = 30 // warn } \ No newline at end of file diff --git a/tests/init/neg/override38.scala b/tests/init/warn/override38.scala similarity index 77% rename from tests/init/neg/override38.scala rename to tests/init/warn/override38.scala index dd47b0438980..feb962cd5029 100644 --- a/tests/init/neg/override38.scala +++ b/tests/init/warn/override38.scala @@ -1,7 +1,7 @@ abstract class A { def f: Int - (1 to 10).foreach { i => // error + (1 to 10).foreach { i => // warn f } diff --git a/tests/init/neg/override39.scala b/tests/init/warn/override39.scala similarity index 82% rename from tests/init/neg/override39.scala rename to tests/init/warn/override39.scala index 723e71554da2..34f25cee2022 100644 --- a/tests/init/neg/override39.scala +++ b/tests/init/warn/override39.scala @@ -6,6 +6,6 @@ abstract class Parent extends Product { } case class Child(x: Int) extends Parent { - val m = 10 // error + val m = 10 // warn def productArity: Int = m } \ No newline at end of file diff --git a/tests/init/neg/override4.scala b/tests/init/warn/override4.scala similarity index 82% rename from tests/init/neg/override4.scala rename to tests/init/warn/override4.scala index 1489e1c2508b..1a63d2b3b59b 100644 --- a/tests/init/neg/override4.scala +++ b/tests/init/warn/override4.scala @@ -12,7 +12,7 @@ class Bar extends Foo { } class Bar2 extends Bar { - val mymap: mutable.Map[Int, String] = mutable.Map.empty // error + val mymap: mutable.Map[Int, String] = mutable.Map.empty // warn override def enter(k: Int, v: String) = { mymap(k) = v diff --git a/tests/init/neg/override40.scala b/tests/init/warn/override40.scala similarity index 80% rename from tests/init/neg/override40.scala rename to tests/init/warn/override40.scala index 2f081a9de30b..305210158d54 100644 --- a/tests/init/neg/override40.scala +++ b/tests/init/warn/override40.scala @@ -6,5 +6,5 @@ abstract class A { class B extends A { this.getClass f - val a = 20 // error + val a = 20 // warn } \ No newline at end of file diff --git a/tests/init/neg/override41.scala b/tests/init/warn/override41.scala similarity index 82% rename from tests/init/neg/override41.scala rename to tests/init/warn/override41.scala index bfd5bc18f3d6..6cb58ae326aa 100644 --- a/tests/init/neg/override41.scala +++ b/tests/init/warn/override41.scala @@ -11,5 +11,5 @@ class Child extends Parent { def show = println(name) - val name = "child" // error + val name = "child" // warn } \ No newline at end of file diff --git a/tests/init/neg/override42.scala b/tests/init/warn/override42.scala similarity index 81% rename from tests/init/neg/override42.scala rename to tests/init/warn/override42.scala index b4a53b977852..39a4d5097215 100644 --- a/tests/init/neg/override42.scala +++ b/tests/init/warn/override42.scala @@ -12,5 +12,5 @@ class Bar { def show = println(name) - val name = "child" // error + val name = "child" // warn } diff --git a/tests/init/neg/override43.scala b/tests/init/warn/override43.scala similarity index 83% rename from tests/init/neg/override43.scala rename to tests/init/warn/override43.scala index 2d55742c3ecd..ab8ec95133d6 100644 --- a/tests/init/neg/override43.scala +++ b/tests/init/warn/override43.scala @@ -8,6 +8,6 @@ final class Child extends Parent { def g() = foo() g() + b - val b = 10 // error + val b = 10 // warn g() } \ No newline at end of file diff --git a/tests/init/neg/override44.scala b/tests/init/warn/override44.scala similarity index 83% rename from tests/init/neg/override44.scala rename to tests/init/warn/override44.scala index ed7a0ae30b7a..50e7691d6fee 100644 --- a/tests/init/neg/override44.scala +++ b/tests/init/warn/override44.scala @@ -8,6 +8,6 @@ class Child extends Parent { def g() = foo() g() + b - val b = 10 // error + val b = 10 // warn g() } \ No newline at end of file diff --git a/tests/init/neg/override45.scala b/tests/init/warn/override45.scala similarity index 81% rename from tests/init/neg/override45.scala rename to tests/init/warn/override45.scala index dbf767239e6b..7eb0ba2f8cca 100644 --- a/tests/init/neg/override45.scala +++ b/tests/init/warn/override45.scala @@ -8,5 +8,5 @@ class Child extends Parent { val x = a val y = b override def f: Int = z - val z = 30 // error + val z = 30 // warn } \ No newline at end of file diff --git a/tests/init/neg/override46.scala b/tests/init/warn/override46.scala similarity index 75% rename from tests/init/neg/override46.scala rename to tests/init/warn/override46.scala index 397ec85a6984..f10d4516439c 100644 --- a/tests/init/neg/override46.scala +++ b/tests/init/warn/override46.scala @@ -1,5 +1,5 @@ trait TA { - val x = "world" // error + val x = "world" // warn } trait TB { this: TA => diff --git a/tests/init/neg/override5.scala b/tests/init/warn/override5.scala similarity index 78% rename from tests/init/neg/override5.scala rename to tests/init/warn/override5.scala index 061a41dc3fc2..fe9e3bfbde70 100644 --- a/tests/init/neg/override5.scala +++ b/tests/init/warn/override5.scala @@ -5,7 +5,7 @@ trait Foo { } class Bar extends Foo { - val name = "Jack" // error + val name = "Jack" // warn } @@ -16,7 +16,7 @@ trait Zen { } class Tao extends Zen { - val name = "Jack" // error + val name = "Jack" // warn } diff --git a/tests/init/neg/override6.scala b/tests/init/warn/override6.scala similarity index 70% rename from tests/init/neg/override6.scala rename to tests/init/warn/override6.scala index 0c04ea91300d..e8103d999151 100644 --- a/tests/init/neg/override6.scala +++ b/tests/init/warn/override6.scala @@ -4,5 +4,5 @@ trait Foo { } class Bar extends Foo { - val name = "Jack" // error + val name = "Jack" // warn } \ No newline at end of file diff --git a/tests/init/neg/override7.scala b/tests/init/warn/override7.scala similarity index 87% rename from tests/init/neg/override7.scala rename to tests/init/warn/override7.scala index 0a36f02b2790..41fbcd00be69 100644 --- a/tests/init/neg/override7.scala +++ b/tests/init/warn/override7.scala @@ -7,7 +7,7 @@ trait Foo { } class Bar(val name: String) extends Foo { - val title = "Mr." // error + val title = "Mr." // warn def getName = name // ok: name is a Param field diff --git a/tests/init/neg/override8.scala b/tests/init/warn/override8.scala similarity index 93% rename from tests/init/neg/override8.scala rename to tests/init/warn/override8.scala index 526fd5a7f3a3..272143011efc 100644 --- a/tests/init/neg/override8.scala +++ b/tests/init/warn/override8.scala @@ -6,7 +6,7 @@ trait Foo { } trait Bar { - val m = "hello" // error + val m = "hello" // warn def foo(n: Int) = m diff --git a/tests/init/neg/override9.scala b/tests/init/warn/override9.scala similarity index 64% rename from tests/init/neg/override9.scala rename to tests/init/warn/override9.scala index 1b4d32b3e5a3..12dbfde19ec3 100644 --- a/tests/init/neg/override9.scala +++ b/tests/init/warn/override9.scala @@ -1,6 +1,6 @@ trait Foo { def name: String - val message = "hello, " + name // error + val message = "hello, " + name // warn } class Bar extends Foo { diff --git a/tests/init/neg/polyfun.scala b/tests/init/warn/polyfun.scala similarity index 72% rename from tests/init/neg/polyfun.scala rename to tests/init/warn/polyfun.scala index a3a3ecc76814..5ac11721c061 100644 --- a/tests/init/neg/polyfun.scala +++ b/tests/init/warn/polyfun.scala @@ -4,5 +4,5 @@ class Test { println(n) arg } - val n = m.apply(arg = 23) // error + val n = m.apply(arg = 23) // warn } diff --git a/tests/init/neg/private.scala b/tests/init/warn/private.scala similarity index 84% rename from tests/init/neg/private.scala rename to tests/init/warn/private.scala index 658860ab577c..215f0db3deee 100644 --- a/tests/init/neg/private.scala +++ b/tests/init/warn/private.scala @@ -6,7 +6,7 @@ class A(a: Int) { class B extends A(3) { foo() println(a) - val a = 3 // error + val a = 3 // warn } class C extends A(3) { diff --git a/tests/init/neg/promote-warm.scala b/tests/init/warn/promote-warm.scala similarity index 84% rename from tests/init/neg/promote-warm.scala rename to tests/init/warn/promote-warm.scala index c9f9268f1fbd..c776d37a924e 100644 --- a/tests/init/neg/promote-warm.scala +++ b/tests/init/warn/promote-warm.scala @@ -6,7 +6,7 @@ class PromoteWarm: a.foo() val a = new A - val b = new B(a) // error + val b = new B(a) // warn val n = 10 def foo() = println(n) diff --git a/tests/init/neg/promote.scala b/tests/init/warn/promote.scala similarity index 82% rename from tests/init/neg/promote.scala rename to tests/init/warn/promote.scala index 70e951d78f6f..a97122d57a62 100644 --- a/tests/init/neg/promote.scala +++ b/tests/init/warn/promote.scala @@ -4,6 +4,6 @@ class Wrap { abstract class E[+T] { def foo: T } object E { final val A: E[Nothing] = new E { def foo = ref } - val ref = qux(A) // error + val ref = qux(A) // warn } } \ No newline at end of file diff --git a/tests/init/neg/promotion-loop.scala b/tests/init/warn/promotion-loop.scala similarity index 86% rename from tests/init/neg/promotion-loop.scala rename to tests/init/warn/promotion-loop.scala index 7f6856c34cae..c94422daca76 100644 --- a/tests/init/neg/promotion-loop.scala +++ b/tests/init/warn/promotion-loop.scala @@ -13,7 +13,7 @@ class Test { test => } val b = new B - println(b) // error + println(b) // warn val n = 10 } \ No newline at end of file diff --git a/tests/init/neg/promotion-segment.scala b/tests/init/warn/promotion-segment.scala similarity index 85% rename from tests/init/neg/promotion-segment.scala rename to tests/init/warn/promotion-segment.scala index 56968ce79c56..542ee23623f1 100644 --- a/tests/init/neg/promotion-segment.scala +++ b/tests/init/warn/promotion-segment.scala @@ -8,5 +8,5 @@ class Outer: def bar(c: C) = c.foo() - bar(new C) // error + bar(new C) // warn val m = 10 diff --git a/tests/init/neg/promotion-segment2.scala b/tests/init/warn/promotion-segment2.scala similarity index 87% rename from tests/init/neg/promotion-segment2.scala rename to tests/init/warn/promotion-segment2.scala index d3ba8dedf0ce..39cd7129950f 100644 --- a/tests/init/neg/promotion-segment2.scala +++ b/tests/init/warn/promotion-segment2.scala @@ -8,5 +8,5 @@ class Outer: def bar(c: C) = c.foo() - bar(new C) // error + bar(new C) // warn val m = 10 diff --git a/tests/init/neg/promotion-segment3.scala b/tests/init/warn/promotion-segment3.scala similarity index 82% rename from tests/init/neg/promotion-segment3.scala rename to tests/init/warn/promotion-segment3.scala index 9e62291953d3..5dab2224743b 100644 --- a/tests/init/neg/promotion-segment3.scala +++ b/tests/init/warn/promotion-segment3.scala @@ -6,6 +6,6 @@ class A: def bar(b: B) = new b.C().foo() - bar(new B) // error + bar(new B) // warn val m = 10 diff --git a/tests/init/neg/secondary-ctor.scala b/tests/init/warn/secondary-ctor.scala similarity index 87% rename from tests/init/neg/secondary-ctor.scala rename to tests/init/warn/secondary-ctor.scala index d96e149529d0..92a77b11b57a 100644 --- a/tests/init/neg/secondary-ctor.scala +++ b/tests/init/warn/secondary-ctor.scala @@ -15,5 +15,5 @@ class C(b: B) extends A(b) { class D { val b = new B(this) - val c = new C(b, 5) // error + val c = new C(b, 5) // warn } diff --git a/tests/init/neg/secondary-ctor2.scala b/tests/init/warn/secondary-ctor2.scala similarity index 91% rename from tests/init/neg/secondary-ctor2.scala rename to tests/init/warn/secondary-ctor2.scala index 462ff2dbcfaa..5518bbf974e7 100644 --- a/tests/init/neg/secondary-ctor2.scala +++ b/tests/init/warn/secondary-ctor2.scala @@ -21,5 +21,5 @@ class C(b: B) extends A(b) { class D { val b = new B(this) - val c = new C(b, 5) // error + val c = new C(b, 5) // warn } diff --git a/tests/init/neg/secondary-ctor3.scala b/tests/init/warn/secondary-ctor3.scala similarity index 94% rename from tests/init/neg/secondary-ctor3.scala rename to tests/init/warn/secondary-ctor3.scala index 3bbfc413e262..ed01c6fcbe30 100644 --- a/tests/init/neg/secondary-ctor3.scala +++ b/tests/init/warn/secondary-ctor3.scala @@ -35,5 +35,5 @@ def foo() = class D { val b = new B(this) - val c = new C(b, 5) // error + val c = new C(b, 5) // warn } diff --git a/tests/init/warn/simple1.scala b/tests/init/warn/simple1.scala new file mode 100644 index 000000000000..9f8ce2f5c487 --- /dev/null +++ b/tests/init/warn/simple1.scala @@ -0,0 +1,4 @@ +class Foo { + val len = name.size + val name: String = "Jack" // warn +} \ No newline at end of file diff --git a/tests/init/neg/simple2.scala b/tests/init/warn/simple2.scala similarity index 86% rename from tests/init/neg/simple2.scala rename to tests/init/warn/simple2.scala index 70a7f8407c6b..63fa64d5a113 100644 --- a/tests/init/neg/simple2.scala +++ b/tests/init/warn/simple2.scala @@ -4,7 +4,7 @@ class Box(x: Int) { List(3, 4, 5).map(_ * 2) - private var a = "hello" // error + private var a = "hello" // warn def f(m: Int) = m + a.size } diff --git a/tests/init/neg/simple3.scala b/tests/init/warn/simple3.scala similarity index 64% rename from tests/init/neg/simple3.scala rename to tests/init/warn/simple3.scala index 70de74b35bd4..245f982a807b 100644 --- a/tests/init/neg/simple3.scala +++ b/tests/init/warn/simple3.scala @@ -1,5 +1,5 @@ class Foo { val list = List(4, 6) val n = len + 5 - val len = list.size // error + val len = list.size // warn } diff --git a/tests/init/neg/simple5.scala b/tests/init/warn/simple5.scala similarity index 68% rename from tests/init/neg/simple5.scala rename to tests/init/warn/simple5.scala index 9c9d7d053830..bd9506076d26 100644 --- a/tests/init/neg/simple5.scala +++ b/tests/init/warn/simple5.scala @@ -6,7 +6,7 @@ class Foo { b - val name = "Jack" // error + val name = "Jack" // warn } class Bar { @@ -17,5 +17,5 @@ class Bar { b - val name = "Jack" // error + val name = "Jack" // warn } \ No newline at end of file diff --git a/tests/init/neg/soundness1.scala b/tests/init/warn/soundness1.scala similarity index 81% rename from tests/init/neg/soundness1.scala rename to tests/init/warn/soundness1.scala index d528b374f004..4d71c3e52747 100644 --- a/tests/init/neg/soundness1.scala +++ b/tests/init/warn/soundness1.scala @@ -20,10 +20,10 @@ object Test2: object Test3: class A(b: B) { println(b.a2) - val b2 = new B(this) // error + val b2 = new B(this) // warn } class B(a: A) { println(a.b2) - val a2 = new A(this) // error + val a2 = new A(this) // warn } diff --git a/tests/init/neg/soundness2.scala b/tests/init/warn/soundness2.scala similarity index 50% rename from tests/init/neg/soundness2.scala rename to tests/init/warn/soundness2.scala index 3d2821377111..6015ea46c3d7 100644 --- a/tests/init/neg/soundness2.scala +++ b/tests/init/warn/soundness2.scala @@ -1,4 +1,4 @@ class C(c: C) { val d = c.c2 - val c2 = new C(this) // error + val c2 = new C(this) // warn } diff --git a/tests/init/warn/soundness4.scala b/tests/init/warn/soundness4.scala new file mode 100644 index 000000000000..24060f2be083 --- /dev/null +++ b/tests/init/warn/soundness4.scala @@ -0,0 +1,3 @@ +class Foo { + val a : Foo = this.a.a // warn +} \ No newline at end of file diff --git a/tests/init/neg/soundness6.scala b/tests/init/warn/soundness6.scala similarity index 58% rename from tests/init/neg/soundness6.scala rename to tests/init/warn/soundness6.scala index 09d55dba292c..2893c3a4e301 100644 --- a/tests/init/neg/soundness6.scala +++ b/tests/init/warn/soundness6.scala @@ -1,5 +1,5 @@ class C(c: C) { println(c.n) - val c2 = new C(this) // error + val c2 = new C(this) // warn val n = 10 } diff --git a/tests/init/neg/structural.scala b/tests/init/warn/structural.scala similarity index 86% rename from tests/init/neg/structural.scala rename to tests/init/warn/structural.scala index 27b37a04bef7..bf20529a8007 100644 --- a/tests/init/neg/structural.scala +++ b/tests/init/warn/structural.scala @@ -8,5 +8,5 @@ class Test { n + x } - val n = m(23) // error + val n = m(23) // warn } diff --git a/tests/init/neg/super-resolution.scala b/tests/init/warn/super-resolution.scala similarity index 82% rename from tests/init/neg/super-resolution.scala rename to tests/init/warn/super-resolution.scala index d2674bc597e1..6fa295ed5187 100644 --- a/tests/init/neg/super-resolution.scala +++ b/tests/init/warn/super-resolution.scala @@ -16,8 +16,8 @@ trait N extends A with B: class C extends A with M with N: foo() - val a = 10 // error - val b = 20 // error - val m = 30 // error + val a = 10 // warn + val b = 20 // warn + val m = 30 // warn val n = 40 diff --git a/tests/init/neg/super-resolution2.scala b/tests/init/warn/super-resolution2.scala similarity index 84% rename from tests/init/neg/super-resolution2.scala rename to tests/init/warn/super-resolution2.scala index 283fb25a467d..5009e2f3aa64 100644 --- a/tests/init/neg/super-resolution2.scala +++ b/tests/init/warn/super-resolution2.scala @@ -15,6 +15,6 @@ class N extends A with B: new Inner - val m = 30 // error - val n = 40 // error + val m = 30 // warn + val n = 40 // warn val a = 50 diff --git a/tests/init/neg/super-resolution3.scala b/tests/init/warn/super-resolution3.scala similarity index 81% rename from tests/init/neg/super-resolution3.scala rename to tests/init/warn/super-resolution3.scala index 4d510ef22e61..e1b7a2ba3541 100644 --- a/tests/init/neg/super-resolution3.scala +++ b/tests/init/warn/super-resolution3.scala @@ -21,7 +21,7 @@ trait N extends A with B: class C extends A with M with N: new Inner() - val a = 10 // error - val b = 20 // error - val m = 30 // error - val n = 40 // error + val a = 10 // warn + val b = 20 // warn + val m = 30 // warn + val n = 40 // warn diff --git a/tests/init/neg/super.scala b/tests/init/warn/super.scala similarity index 87% rename from tests/init/neg/super.scala rename to tests/init/warn/super.scala index 5a8e72cce65f..9b0b88136f20 100644 --- a/tests/init/neg/super.scala +++ b/tests/init/warn/super.scala @@ -20,11 +20,11 @@ class Bar extends A, B, C: override def foo() = n * n - val n = 10 // error + val n = 10 // warn class Qux extends A, B, C: super.foo() override def foo() = n * n - val n = 10 // error + val n = 10 // warn diff --git a/tests/init/neg/t3273.scala b/tests/init/warn/t3273.scala similarity index 90% rename from tests/init/neg/t3273.scala rename to tests/init/warn/t3273.scala index 141e544bdfeb..297b3bbf0d44 100644 --- a/tests/init/neg/t3273.scala +++ b/tests/init/warn/t3273.scala @@ -1,8 +1,8 @@ import scala.language.implicitConversions object Test { - val num1: LazyList[Int] = 1 #:: num1.map(_ + 1) // error - val num2: LazyList[Int] = 1 #:: num2.iterator.map(_ + 1).to(LazyList) // error + val num1: LazyList[Int] = 1 #:: num1.map(_ + 1) // warn + val num2: LazyList[Int] = 1 #:: num2.iterator.map(_ + 1).to(LazyList) // warn def main(args: Array[String]): Unit = { val x1 = (num1 take 10).toList diff --git a/tests/init/neg/trees.scala b/tests/init/warn/trees.scala similarity index 78% rename from tests/init/neg/trees.scala rename to tests/init/warn/trees.scala index 836f02e9c551..96ae170075c5 100644 --- a/tests/init/neg/trees.scala +++ b/tests/init/warn/trees.scala @@ -3,5 +3,5 @@ class Trees { class ValDef { counter += 1 } class EmptyValDef extends ValDef val theEmptyValDef = new EmptyValDef - private var counter = 0 // error + private var counter = 0 // warn } diff --git a/tests/init/neg/unsound1.scala b/tests/init/warn/unsound1.scala similarity index 80% rename from tests/init/neg/unsound1.scala rename to tests/init/warn/unsound1.scala index 3854504c8478..b017d1cd9f37 100644 --- a/tests/init/neg/unsound1.scala +++ b/tests/init/warn/unsound1.scala @@ -1,5 +1,5 @@ class A(m: Int) { - if (m > 0) println(foo(m - 1).a2.n) // error + if (m > 0) println(foo(m - 1).a2.n) // warn def foo(n: Int): B = if (n % 2 == 0) new B(new A(n - 1), foo(n - 1).a1) diff --git a/tests/init/neg/unsound2.scala b/tests/init/warn/unsound2.scala similarity index 88% rename from tests/init/neg/unsound2.scala rename to tests/init/warn/unsound2.scala index 5ae0c624c32e..d8b017f2c7db 100644 --- a/tests/init/neg/unsound2.scala +++ b/tests/init/warn/unsound2.scala @@ -2,7 +2,7 @@ case class A(x: Int) { def foo(y: Int): B = if (y > 10) then B(bar(y - 1), foo(y - 1).getN) else B(bar(y), 10) def bar(y: Int): A = if (y > 10) then A(y - 1) else this class B(a: A, b: Int) { - def getN: Int = a.n // error + def getN: Int = a.n // warn def getB: Int = b } println(foo(x).getB) diff --git a/tests/init/neg/unsound3.scala b/tests/init/warn/unsound3.scala similarity index 72% rename from tests/init/neg/unsound3.scala rename to tests/init/warn/unsound3.scala index 9ede5c7f97d0..021505cb9931 100644 --- a/tests/init/neg/unsound3.scala +++ b/tests/init/warn/unsound3.scala @@ -7,7 +7,7 @@ class C { def foo(): B = { x += 1 val newB = new B(this) - if (x < 12) then foo().getC().b else newB // error + if (x < 12) then foo().getC().b else newB // warn } val b = foo() } \ No newline at end of file diff --git a/tests/init/neg/unsound4.scala b/tests/init/warn/unsound4.scala similarity index 70% rename from tests/init/neg/unsound4.scala rename to tests/init/warn/unsound4.scala index 8a6e26fe8a6b..2b1a69723342 100644 --- a/tests/init/neg/unsound4.scala +++ b/tests/init/warn/unsound4.scala @@ -1,4 +1,4 @@ class A { def foo(x: Int): A = if (x < 5) then this else foo(x - 1).aAgain - val aAgain = foo(5) // error + val aAgain = foo(5) // warn } \ No newline at end of file diff --git a/tests/warn/i9740d.scala b/tests/warn/i9740d.scala index 118ee20582dd..87c7dc264afa 100644 --- a/tests/warn/i9740d.scala +++ b/tests/warn/i9740d.scala @@ -8,6 +8,6 @@ object UnitExp extends Exp[Unit] class Foo[U <: Int, T <: U] { def bar[A <: T](x: Exp[A]): Unit = x match case IntExp(x) => - case StrExp(x) => - case UnitExp => // warn + case StrExp(x) => // warn + case UnitExp => // warn implausible pattern } From a2fee422b38321389dc56a21156c232bafd4285d Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Wed, 8 Nov 2023 18:15:51 +0100 Subject: [PATCH 06/11] Got most of tests to work --- .../dotty/tools/dotc/CompilationTests.scala | 2 + .../dotty/tools/vulpix/ParallelTesting.scala | 11 ++++-- .../init-global/neg/context-sensitivity.check | 11 ++++++ .../init-global/neg/context-sensitivity.scala | 2 +- tests/init-global/neg/global-cycle1.check | 21 +++++++++++ tests/init-global/neg/global-cycle1.scala | 4 +- tests/init-global/neg/global-cycle14.check | 21 +++++++++++ tests/init-global/neg/global-cycle14.scala | 4 +- tests/init-global/neg/global-cycle2.check | 11 ++++++ tests/init-global/neg/global-cycle2.scala | 2 +- tests/init-global/neg/global-cycle3.check | 11 ++++++ tests/init-global/neg/global-cycle3.scala | 2 +- tests/init-global/neg/global-cycle4.check | 11 ++++++ tests/init-global/neg/global-cycle4.scala | 2 +- tests/init-global/neg/global-cycle5.check | 10 +++++ tests/init-global/neg/global-cycle5.scala | 2 +- tests/init-global/neg/global-cycle6.check | 29 +++++++++++++++ tests/init-global/neg/global-cycle6.scala | 4 +- tests/init-global/neg/global-cycle7.check | 21 +++++++++++ tests/init-global/neg/global-cycle7.scala | 4 +- tests/init-global/neg/global-cycle8.check | 17 +++++++++ tests/init-global/neg/global-cycle8.scala | 2 +- .../init-global/neg/global-irrelevance1.check | 10 +++++ .../init-global/neg/global-irrelevance1.scala | 2 +- .../init-global/neg/global-irrelevance2.check | 15 ++++++++ .../init-global/neg/global-irrelevance2.scala | 2 +- .../init-global/neg/global-irrelevance3.check | 12 ++++++ .../init-global/neg/global-irrelevance3.scala | 2 +- .../init-global/neg/global-irrelevance4.check | 13 +++++++ .../init-global/neg/global-irrelevance4.scala | 2 +- .../init-global/neg/global-irrelevance5.check | 10 +++++ .../init-global/neg/global-irrelevance5.scala | 2 +- .../init-global/neg/global-irrelevance6.check | 10 +++++ .../init-global/neg/global-irrelevance6.scala | 2 +- .../init-global/neg/global-irrelevance7.check | 10 +++++ .../init-global/neg/global-irrelevance7.scala | 2 +- tests/init-global/neg/global-list.check | 37 +++++++++++++++++++ tests/init-global/neg/global-list.scala | 4 +- tests/init-global/neg/global-local-var.check | 13 +++++++ tests/init-global/neg/global-local-var.scala | 2 +- tests/init-global/neg/global-region1.check | 11 ++++++ tests/init-global/neg/global-region1.scala | 2 +- tests/init-global/neg/i11262.check | 15 ++++++++ tests/init-global/neg/i11262.scala | 4 +- tests/init-global/neg/i12544b.check | 21 +++++++++++ tests/init-global/neg/i12544b.scala | 4 +- tests/init-global/neg/i9176.check | 9 +++++ tests/init-global/neg/i9176.scala | 2 +- tests/init-global/neg/line-spacing.check | 14 +++++++ tests/init-global/neg/line-spacing.scala | 2 +- tests/init-global/neg/mutable-array.check | 10 +++++ tests/init-global/neg/mutable-array.scala | 2 +- tests/init-global/neg/mutable-read1.check | 10 +++++ tests/init-global/neg/mutable-read1.scala | 2 +- tests/init-global/neg/mutable-read2.check | 10 +++++ tests/init-global/neg/mutable-read2.scala | 2 +- tests/init-global/neg/mutable-read3.check | 10 +++++ tests/init-global/neg/mutable-read3.scala | 2 +- tests/init-global/neg/mutable-read4.check | 10 +++++ tests/init-global/neg/mutable-read4.scala | 2 +- tests/init-global/neg/mutable-read5.check | 12 ++++++ tests/init-global/neg/mutable-read5.scala | 2 +- tests/init-global/neg/mutable-read6.check | 12 ++++++ tests/init-global/neg/mutable-read6.scala | 2 +- tests/init-global/neg/mutable-read7.check | 16 ++++++++ tests/init-global/neg/mutable-read7.scala | 2 +- tests/init-global/neg/mutable-read8.check | 14 +++++++ tests/init-global/neg/mutable-read8.scala | 2 +- tests/init-global/neg/partial-ordering.check | 13 +++++++ tests/init-global/neg/partial-ordering.scala | 2 +- tests/init-global/neg/patmat-unapplySeq.check | 12 ++++++ tests/init-global/neg/patmat-unapplySeq.scala | 2 +- .../init-global/neg/patmat-unapplySeq2.check | 12 ++++++ .../init-global/neg/patmat-unapplySeq2.scala | 2 +- tests/init-global/neg/patmat.check | 27 ++++++++++++++ tests/init-global/neg/patmat.scala | 4 +- tests/init-global/neg/return.check | 11 ++++++ tests/init-global/neg/return.scala | 2 +- tests/init-global/neg/return2.check | 15 ++++++++ tests/init-global/neg/return2.scala | 2 +- tests/init-global/neg/t5366.check | 21 +++++++++++ tests/init-global/neg/t5366.scala | 4 +- tests/init-global/neg/t9115.check | 21 +++++++++++ tests/init-global/neg/t9115.scala | 4 +- tests/init-global/neg/t9261.check | 9 +++++ tests/init-global/neg/t9261.scala | 2 +- tests/init-global/neg/t9312.check | 29 +++++++++++++++ tests/init-global/neg/t9312.scala | 4 +- tests/init-global/neg/t9360.check | 21 +++++++++++ tests/init-global/neg/t9360.scala | 4 +- .../neg/unapply-implicit-arg.check | 9 +++++ .../neg/unapply-implicit-arg.scala | 2 +- .../neg/unapply-implicit-arg2.check | 13 +++++++ .../neg/unapply-implicit-arg2.scala | 2 +- .../neg/unapply-implicit-arg3.check | 15 ++++++++ .../neg/unapply-implicit-arg3.scala | 2 +- .../neg/unapplySeq-implicit-arg.check | 9 +++++ .../neg/unapplySeq-implicit-arg.scala | 2 +- .../neg/unapplySeq-implicit-arg2.check | 13 +++++++ .../neg/unapplySeq-implicit-arg2.scala | 2 +- .../neg/unapplySeq-implicit-arg3.check | 15 ++++++++ .../neg/unapplySeq-implicit-arg3.scala | 2 +- tests/warn/gadt-contradictory-pattern.scala | 2 +- tests/warn/i12253.scala | 2 + tests/warn/i15503d.scala | 6 +-- tests/warn/i16639a.scala | 5 +-- tests/{neg => warn}/i17613b/i17613b.scala | 5 +-- tests/{neg => warn}/i17613b/importTry.scala | 0 tests/warn/nonunit-statement.scala | 2 +- 109 files changed, 814 insertions(+), 77 deletions(-) rename tests/{neg => warn}/i17613b/i17613b.scala (87%) rename tests/{neg => warn}/i17613b/importTry.scala (100%) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 798e998ef241..6562ba369dee 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -211,6 +211,7 @@ class CompilationTests { 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/warn", options).checkWarnings() compileFilesInDir("tests/init-global/pos", options).checkCompile() } @@ -219,6 +220,7 @@ class CompilationTests { implicit val testGroup: TestGroup = TestGroup("checkInit") val options = defaultOptions.and("-Ysafe-init", "-Xfatal-warnings") compileFilesInDir("tests/init/neg", options).checkExpectedErrors() + compileFilesInDir("tests/init/warn", options).checkWarnings() compileFilesInDir("tests/init/pos", options).checkCompile() compileFilesInDir("tests/init/crash", options.without("-Xfatal-warnings")).checkCompile() // The regression test for i12128 has some atypical classpath requirements. diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 4804ffd349cb..37602cc32043 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -755,7 +755,7 @@ trait ParallelTesting extends RunnerOrchestration { self => end maybeFailureMessage def getWarnMapAndExpectedCount(files: Seq[JFile]): (HashMap[String, Integer], Int) = - val comment = raw"//( *)warn".r + val comment = raw"//( *)(nopos-)?warn".r val map = new HashMap[String, Integer]() var count = 0 def bump(key: String): Unit = @@ -766,8 +766,11 @@ trait ParallelTesting extends RunnerOrchestration { self => files.filter(isSourceFile).foreach { file => Using(Source.fromFile(file, StandardCharsets.UTF_8.name)) { source => source.getLines.zipWithIndex.foreach { case (line, lineNbr) => - comment.findAllMatchIn(line).foreach { _ => - bump(s"${file.getPath}:${lineNbr+1}") + comment.findAllMatchIn(line).foreach { m => + m.group(2) match + case "nopos-" => + bump("nopos") + case _ => bump(s"${file.getPath}:${lineNbr+1}") } } }.get @@ -788,7 +791,7 @@ trait ParallelTesting extends RunnerOrchestration { self => val key = s"${relativize(srcpos.source.file.toString())}:${srcpos.line + 1}" if !seenAt(key) then unexpected += key else - unpositioned += relativize(srcpos.source.file.toString()) + if(!seenAt("nopos")) unpositioned += relativize(srcpos.source.file.toString()) reporterWarnings.foreach(sawDiagnostic) diff --git a/tests/init-global/neg/context-sensitivity.check b/tests/init-global/neg/context-sensitivity.check index e69de29bb2d1..4c7e679685a1 100644 --- a/tests/init-global/neg/context-sensitivity.check +++ b/tests/init-global/neg/context-sensitivity.check @@ -0,0 +1,11 @@ +-- Warning: tests/init-global/neg/context-sensitivity.scala:9:21 ------------------------------------------------------- +9 | def foo(): Int = A.m + | ^^^ + | Access uninitialized field value m. Call trace: + | -> object A: [ context-sensitivity.scala:14 ] + | ^ + | -> val m: Int = box1.value.foo() [ context-sensitivity.scala:17 ] + | ^^^^^^^^^^^^^^^^ + | -> def foo(): Int = A.m [ context-sensitivity.scala:9 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/context-sensitivity.scala b/tests/init-global/neg/context-sensitivity.scala index 98d1ca13b3fd..7b7477df5773 100644 --- a/tests/init-global/neg/context-sensitivity.scala +++ b/tests/init-global/neg/context-sensitivity.scala @@ -6,7 +6,7 @@ class C(var x: Int) extends Foo { } class D(var y: Int) extends Foo { - def foo(): Int = A.m // error + def foo(): Int = A.m } class Box(var value: Foo) diff --git a/tests/init-global/neg/global-cycle1.check b/tests/init-global/neg/global-cycle1.check index e69de29bb2d1..17f6006e9d4d 100644 --- a/tests/init-global/neg/global-cycle1.check +++ b/tests/init-global/neg/global-cycle1.check @@ -0,0 +1,21 @@ +-- Warning: tests/init-global/neg/global-cycle1.scala:1:7 -------------------------------------------------------------- +1 |object A { + | ^ + | Cyclic initialization: object A -> object B -> object A. Calling trace: + | -> object A { [ global-cycle1.scala:1 ] + | ^ + | -> val a: Int = B.b [ global-cycle1.scala:2 ] + | ^ + | -> object B { [ global-cycle1.scala:5 ] + | ^ + | -> val b: Int = A.a [ global-cycle1.scala:6 ] + | ^ +-- Warning: tests/init-global/neg/global-cycle1.scala:6:17 ------------------------------------------------------------- +6 | val b: Int = A.a + | ^^^ + | Access uninitialized field value a. Call trace: + | -> object B { [ global-cycle1.scala:5 ] + | ^ + | -> val b: Int = A.a [ global-cycle1.scala:6 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle1.scala b/tests/init-global/neg/global-cycle1.scala index f52dcce31832..992d3eacc6f5 100644 --- a/tests/init-global/neg/global-cycle1.scala +++ b/tests/init-global/neg/global-cycle1.scala @@ -1,9 +1,9 @@ -object A { // error +object A { val a: Int = B.b } object B { - val b: Int = A.a // error + val b: Int = A.a } @main diff --git a/tests/init-global/neg/global-cycle14.check b/tests/init-global/neg/global-cycle14.check index e69de29bb2d1..29c28fbd1bc4 100644 --- a/tests/init-global/neg/global-cycle14.check +++ b/tests/init-global/neg/global-cycle14.check @@ -0,0 +1,21 @@ +-- Warning: tests/init-global/neg/global-cycle14.scala:8:7 ------------------------------------------------------------- +8 |object A { + | ^ + | Cyclic initialization: object A -> object B -> object A. Calling trace: + | -> object A { [ global-cycle14.scala:8 ] + | ^ + | -> val n: Int = B.m [ global-cycle14.scala:9 ] + | ^ + | -> object B { [ global-cycle14.scala:12 ] + | ^ + | -> val m: Int = A.n [ global-cycle14.scala:13 ] + | ^ +-- Warning: tests/init-global/neg/global-cycle14.scala:13:17 ----------------------------------------------------------- +13 | val m: Int = A.n + | ^^^ + | Access uninitialized field value n. Call trace: + | -> object B { [ global-cycle14.scala:12 ] + | ^ + | -> val m: Int = A.n [ global-cycle14.scala:13 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle14.scala b/tests/init-global/neg/global-cycle14.scala index 2cba92c23624..35a3019a2a64 100644 --- a/tests/init-global/neg/global-cycle14.scala +++ b/tests/init-global/neg/global-cycle14.scala @@ -5,12 +5,12 @@ object O { val d = Data(3) } -object A { // error +object A { val n: Int = B.m } object B { - val m: Int = A.n // error + val m: Int = A.n } // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle2.check b/tests/init-global/neg/global-cycle2.check index e69de29bb2d1..96bedda57cb5 100644 --- a/tests/init-global/neg/global-cycle2.check +++ b/tests/init-global/neg/global-cycle2.check @@ -0,0 +1,11 @@ +-- Warning: tests/init-global/neg/global-cycle2.scala:6:21 ------------------------------------------------------------- +6 | def foo(): Int = A.a * 2 + | ^^^ + | Access uninitialized field value a. Call trace: + | -> object A { [ global-cycle2.scala:1 ] + | ^ + | -> val a: Int = B.foo() [ global-cycle2.scala:2 ] + | ^^^^^^^ + | -> def foo(): Int = A.a * 2 [ global-cycle2.scala:6 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle2.scala b/tests/init-global/neg/global-cycle2.scala index ccf865d58cbf..f3bd33a1c179 100644 --- a/tests/init-global/neg/global-cycle2.scala +++ b/tests/init-global/neg/global-cycle2.scala @@ -3,7 +3,7 @@ object A { } object B { - def foo(): Int = A.a * 2 // error + def foo(): Int = A.a * 2 } // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-cycle3.check b/tests/init-global/neg/global-cycle3.check index e69de29bb2d1..c8caac77ac40 100644 --- a/tests/init-global/neg/global-cycle3.check +++ b/tests/init-global/neg/global-cycle3.check @@ -0,0 +1,11 @@ +-- Warning: tests/init-global/neg/global-cycle3.scala:2:21 ------------------------------------------------------------- +2 | def foo(): Int = B.a + 10 + | ^^^ + | Access uninitialized field value a. Call trace: + | -> object B { [ global-cycle3.scala:5 ] + | ^ + | -> val a: Int = A(4).foo() [ global-cycle3.scala:6 ] + | ^^^^^^^^^^ + | -> def foo(): Int = B.a + 10 [ global-cycle3.scala:2 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle3.scala b/tests/init-global/neg/global-cycle3.scala index cf24db395d1c..5e97ba59c735 100644 --- a/tests/init-global/neg/global-cycle3.scala +++ b/tests/init-global/neg/global-cycle3.scala @@ -1,5 +1,5 @@ class A(x: Int) { - def foo(): Int = B.a + 10 // error + def foo(): Int = B.a + 10 } object B { diff --git a/tests/init-global/neg/global-cycle4.check b/tests/init-global/neg/global-cycle4.check index e69de29bb2d1..39c08224c7ba 100644 --- a/tests/init-global/neg/global-cycle4.check +++ b/tests/init-global/neg/global-cycle4.check @@ -0,0 +1,11 @@ +-- Warning: tests/init-global/neg/global-cycle4.scala:10:21 ------------------------------------------------------------ +10 | def foo(): Int = O.a + 10 + | ^^^ + | Access uninitialized field value a. Call trace: + | -> object O { [ global-cycle4.scala:17 ] + | ^ + | -> val a: Int = D(5).bar().foo() [ global-cycle4.scala:18 ] + | ^^^^^^^^^^^^^^^^ + | -> def foo(): Int = O.a + 10 [ global-cycle4.scala:10 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle4.scala b/tests/init-global/neg/global-cycle4.scala index 587ee948fba1..789d682da3be 100644 --- a/tests/init-global/neg/global-cycle4.scala +++ b/tests/init-global/neg/global-cycle4.scala @@ -7,7 +7,7 @@ class B extends A { } class C extends A { - def foo(): Int = O.a + 10 // error + def foo(): Int = O.a + 10 } class D(x: Int) { diff --git a/tests/init-global/neg/global-cycle5.check b/tests/init-global/neg/global-cycle5.check index e69de29bb2d1..494fed8a7dd3 100644 --- a/tests/init-global/neg/global-cycle5.check +++ b/tests/init-global/neg/global-cycle5.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/global-cycle5.scala:10:17 ------------------------------------------------------------ +10 | val b: Int = A.a.foo() + | ^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B { [ global-cycle5.scala:9 ] + | ^ + |-> val b: Int = A.a.foo() [ global-cycle5.scala:10 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle5.scala b/tests/init-global/neg/global-cycle5.scala index d0951d6c8972..281ea9b879d1 100644 --- a/tests/init-global/neg/global-cycle5.scala +++ b/tests/init-global/neg/global-cycle5.scala @@ -7,7 +7,7 @@ object A { } object B { - val b: Int = A.a.foo() // error + val b: Int = A.a.foo() } class Y extends X { diff --git a/tests/init-global/neg/global-cycle6.check b/tests/init-global/neg/global-cycle6.check index e69de29bb2d1..5790b84bdb03 100644 --- a/tests/init-global/neg/global-cycle6.check +++ b/tests/init-global/neg/global-cycle6.check @@ -0,0 +1,29 @@ +-- Warning: tests/init-global/neg/global-cycle6.scala:1:7 -------------------------------------------------------------- +1 |object A { + | ^ + | Cyclic initialization: object A -> object B -> object A. Calling trace: + | -> object A { [ global-cycle6.scala:1 ] + | ^ + | -> val n: Int = B.m [ global-cycle6.scala:2 ] + | ^ + | -> object B { [ global-cycle6.scala:8 ] + | ^ + | -> val a = new A.Inner [ global-cycle6.scala:9 ] + | ^^^^^^^^^^^ + | -> class Inner { [ global-cycle6.scala:3 ] + | ^ + | -> println(n) [ global-cycle6.scala:4 ] + | ^ +-- Warning: tests/init-global/neg/global-cycle6.scala:4:12 ------------------------------------------------------------- +4 | println(n) + | ^ + | Access uninitialized field value n. Call trace: + | -> object B { [ global-cycle6.scala:8 ] + | ^ + | -> val a = new A.Inner [ global-cycle6.scala:9 ] + | ^^^^^^^^^^^ + | -> class Inner { [ global-cycle6.scala:3 ] + | ^ + | -> println(n) [ global-cycle6.scala:4 ] + | ^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle6.scala b/tests/init-global/neg/global-cycle6.scala index a1d9e64689b9..88adc536b307 100644 --- a/tests/init-global/neg/global-cycle6.scala +++ b/tests/init-global/neg/global-cycle6.scala @@ -1,7 +1,7 @@ -object A { // error +object A { val n: Int = B.m class Inner { - println(n) // error + println(n) } } diff --git a/tests/init-global/neg/global-cycle7.check b/tests/init-global/neg/global-cycle7.check index e69de29bb2d1..e55192ebea8c 100644 --- a/tests/init-global/neg/global-cycle7.check +++ b/tests/init-global/neg/global-cycle7.check @@ -0,0 +1,21 @@ +-- Warning: tests/init-global/neg/global-cycle7.scala:1:7 -------------------------------------------------------------- +1 |object A { + | ^ + | Cyclic initialization: object A -> object B -> object A. Calling trace: + | -> object A { [ global-cycle7.scala:1 ] + | ^ + | -> val n: Int = B.m [ global-cycle7.scala:2 ] + | ^ + | -> object B { [ global-cycle7.scala:5 ] + | ^ + | -> val m: Int = A.n [ global-cycle7.scala:6 ] + | ^ +-- Warning: tests/init-global/neg/global-cycle7.scala:6:17 ------------------------------------------------------------- +6 | val m: Int = A.n + | ^^^ + | Access uninitialized field value n. Call trace: + | -> object B { [ global-cycle7.scala:5 ] + | ^ + | -> val m: Int = A.n [ global-cycle7.scala:6 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle7.scala b/tests/init-global/neg/global-cycle7.scala index a0f0d0379b3d..b8084984aeec 100644 --- a/tests/init-global/neg/global-cycle7.scala +++ b/tests/init-global/neg/global-cycle7.scala @@ -1,9 +1,9 @@ -object A { // error +object A { val n: Int = B.m } object B { - val m: Int = A.n // error + val m: Int = A.n } abstract class TokensCommon { diff --git a/tests/init-global/neg/global-cycle8.check b/tests/init-global/neg/global-cycle8.check index e69de29bb2d1..b19272294bd5 100644 --- a/tests/init-global/neg/global-cycle8.check +++ b/tests/init-global/neg/global-cycle8.check @@ -0,0 +1,17 @@ +-- Warning: tests/init-global/neg/global-cycle8.scala:9:7 -------------------------------------------------------------- +9 |object O { + | ^ + | Cyclic initialization: object O -> object P -> object O. Calling trace: + | -> object O { [ global-cycle8.scala:9 ] + | ^ + | -> println(P.m) [ global-cycle8.scala:11 ] + | ^ + | -> object P { [ global-cycle8.scala:14 ] + | ^ + | -> val m = Q.bar(new B) [ global-cycle8.scala:15 ] + | ^^^^^^^^^^^^ + | -> def bar(b: B) = b.a.foo() [ global-cycle8.scala:19 ] + | ^^^^^^^^^ + | -> def foo() = println(O.n) [ global-cycle8.scala:2 ] + | ^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle8.scala b/tests/init-global/neg/global-cycle8.scala index 648711ef8772..91290da30353 100644 --- a/tests/init-global/neg/global-cycle8.scala +++ b/tests/init-global/neg/global-cycle8.scala @@ -6,7 +6,7 @@ class B { val a = new A } -object O { // error +object O { val n: Int = 10 println(P.m) } diff --git a/tests/init-global/neg/global-irrelevance1.check b/tests/init-global/neg/global-irrelevance1.check index e69de29bb2d1..2f09978e3585 100644 --- a/tests/init-global/neg/global-irrelevance1.check +++ b/tests/init-global/neg/global-irrelevance1.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/global-irrelevance1.scala:5:12 ------------------------------------------------------- +5 | var y = A.x * 2 + | ^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ global-irrelevance1.scala:4 ] + | ^ + |-> var y = A.x * 2 [ global-irrelevance1.scala:5 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance1.scala b/tests/init-global/neg/global-irrelevance1.scala index 18c1c16b5ed6..2eb5511001e2 100644 --- a/tests/init-global/neg/global-irrelevance1.scala +++ b/tests/init-global/neg/global-irrelevance1.scala @@ -2,5 +2,5 @@ object A: var x = 6 object B: - var y = A.x * 2 // error + var y = A.x * 2 // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance2.check b/tests/init-global/neg/global-irrelevance2.check index e69de29bb2d1..ab43e2c977ab 100644 --- a/tests/init-global/neg/global-irrelevance2.check +++ b/tests/init-global/neg/global-irrelevance2.check @@ -0,0 +1,15 @@ +-- Warning: tests/init-global/neg/global-irrelevance2.scala:5:6 -------------------------------------------------------- +5 | A.x = b * 2 + | ^^^^^^^^^^^^ + | Mutating object A during initialization of object B. + | Mutating other static objects during the initialization of one static object is forbidden. Calling trace: + | + | -> object B: [ global-irrelevance2.scala:7 ] + | ^ + | -> new B(10) [ global-irrelevance2.scala:8 ] + | ^^^^^^^^^ + | -> class B(b: Int): [ global-irrelevance2.scala:4 ] + | ^ + | -> A.x = b * 2 [ global-irrelevance2.scala:5 ] + | ^^^^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance2.scala b/tests/init-global/neg/global-irrelevance2.scala index 99aed8a0dd47..8804eed6cc52 100644 --- a/tests/init-global/neg/global-irrelevance2.scala +++ b/tests/init-global/neg/global-irrelevance2.scala @@ -2,7 +2,7 @@ object A: var x = 6 class B(b: Int): - A.x = b * 2 // error + A.x = b * 2 object B: new B(10) diff --git a/tests/init-global/neg/global-irrelevance3.check b/tests/init-global/neg/global-irrelevance3.check index e69de29bb2d1..30abdff5da2a 100644 --- a/tests/init-global/neg/global-irrelevance3.check +++ b/tests/init-global/neg/global-irrelevance3.check @@ -0,0 +1,12 @@ +-- Warning: tests/init-global/neg/global-irrelevance3.scala:9:13 ------------------------------------------------------- +9 | (() => x) + | ^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ global-irrelevance3.scala:13 ] + | ^ + |-> var y = A.p.g() [ global-irrelevance3.scala:14 ] + | ^^^^^^^ + |-> (() => x) [ global-irrelevance3.scala:9 ] + | ^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance3.scala b/tests/init-global/neg/global-irrelevance3.scala index d90514f2c489..4b53c0335314 100644 --- a/tests/init-global/neg/global-irrelevance3.scala +++ b/tests/init-global/neg/global-irrelevance3.scala @@ -6,7 +6,7 @@ object A: var x = 6 new Pair( y => x = y, - (() => x) // error + (() => x) ) diff --git a/tests/init-global/neg/global-irrelevance4.check b/tests/init-global/neg/global-irrelevance4.check index e69de29bb2d1..447ca27a4ed3 100644 --- a/tests/init-global/neg/global-irrelevance4.check +++ b/tests/init-global/neg/global-irrelevance4.check @@ -0,0 +1,13 @@ +-- Warning: tests/init-global/neg/global-irrelevance4.scala:8:9 -------------------------------------------------------- +8 | (y => x = y), + | ^^^^^^^^^^ + | Mutating object A during initialization of object B. + | Mutating other static objects during the initialization of one static object is forbidden. Calling trace: + | + | -> object B: [ global-irrelevance4.scala:12 ] + | ^ + | -> A.p.f(10) [ global-irrelevance4.scala:13 ] + | ^^^^^^^^^ + | -> (y => x = y), [ global-irrelevance4.scala:8 ] + | ^^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance4.scala b/tests/init-global/neg/global-irrelevance4.scala index 06c0694fba2e..caf7f2bb6466 100644 --- a/tests/init-global/neg/global-irrelevance4.scala +++ b/tests/init-global/neg/global-irrelevance4.scala @@ -5,7 +5,7 @@ object A: def foo(): Pair = var x = 6 new Pair( - (y => x = y), // error + (y => x = y), () => x ) diff --git a/tests/init-global/neg/global-irrelevance5.check b/tests/init-global/neg/global-irrelevance5.check index e69de29bb2d1..af8a6ab6568d 100644 --- a/tests/init-global/neg/global-irrelevance5.check +++ b/tests/init-global/neg/global-irrelevance5.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/global-irrelevance5.scala:6:17 ------------------------------------------------------- +6 | var y = A.array(0) * 2 + | ^^^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ global-irrelevance5.scala:5 ] + | ^ + |-> var y = A.array(0) * 2 [ global-irrelevance5.scala:6 ] + | ^^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance5.scala b/tests/init-global/neg/global-irrelevance5.scala index 1ab0ed645524..a1cff0aeb802 100644 --- a/tests/init-global/neg/global-irrelevance5.scala +++ b/tests/init-global/neg/global-irrelevance5.scala @@ -3,6 +3,6 @@ object A: array(0) = 10 object B: - var y = A.array(0) * 2 // error + var y = A.array(0) * 2 // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance6.check b/tests/init-global/neg/global-irrelevance6.check index e69de29bb2d1..8b30051e67b8 100644 --- a/tests/init-global/neg/global-irrelevance6.check +++ b/tests/init-global/neg/global-irrelevance6.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/global-irrelevance6.scala:9:17 ------------------------------------------------------- +9 | var y = A.array(0).foo() * 2 + | ^^^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ global-irrelevance6.scala:8 ] + | ^ + |-> var y = A.array(0).foo() * 2 [ global-irrelevance6.scala:9 ] + | ^^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance6.scala b/tests/init-global/neg/global-irrelevance6.scala index c624cd91cff6..a16849a81934 100644 --- a/tests/init-global/neg/global-irrelevance6.scala +++ b/tests/init-global/neg/global-irrelevance6.scala @@ -6,6 +6,6 @@ object A: val n = array(0).foo() // ok, no crash object B: - var y = A.array(0).foo() * 2 // error + var y = A.array(0).foo() * 2 // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-irrelevance7.check b/tests/init-global/neg/global-irrelevance7.check index e69de29bb2d1..37fab85ca045 100644 --- a/tests/init-global/neg/global-irrelevance7.check +++ b/tests/init-global/neg/global-irrelevance7.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/global-irrelevance7.scala:10:17 ------------------------------------------------------ +10 | var y = A.array(0).foo() * 2 + | ^^^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ global-irrelevance7.scala:9 ] + | ^ + |-> var y = A.array(0).foo() * 2 [ global-irrelevance7.scala:10 ] + | ^^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance7.scala b/tests/init-global/neg/global-irrelevance7.scala index f87b97a33cad..f679c9cc60b7 100644 --- a/tests/init-global/neg/global-irrelevance7.scala +++ b/tests/init-global/neg/global-irrelevance7.scala @@ -7,6 +7,6 @@ object A: val n = array(0).foo() // ok object B: - var y = A.array(0).foo() * 2 // error + var y = A.array(0).foo() * 2 // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-list.check b/tests/init-global/neg/global-list.check index e69de29bb2d1..806f61b4c570 100644 --- a/tests/init-global/neg/global-list.check +++ b/tests/init-global/neg/global-list.check @@ -0,0 +1,37 @@ +-- Warning: tests/init-global/neg/global-list.scala:3:7 ---------------------------------------------------------------- +3 |object O: + | ^ + | Cyclic initialization: object O -> object Foo -> object O. Calling trace: + | -> object O: [ global-list.scala:3 ] + | ^ + | -> val a = Foo("Apple") [ global-list.scala:4 ] + | ^^^ + | -> object Foo: [ global-list.scala:8 ] + | ^ + | -> val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] + | ^ +-- Warning: tests/init-global/neg/global-list.scala:9:30 --------------------------------------------------------------- +9 | val all: List[Foo] = List(O.a, O.b, O.c) + | ^^^ + | Access uninitialized field value a. Call trace: + | -> object Foo: [ global-list.scala:8 ] + | ^ + | -> val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] + | ^^^ +-- Warning: tests/init-global/neg/global-list.scala:9:35 --------------------------------------------------------------- +9 | val all: List[Foo] = List(O.a, O.b, O.c) + | ^^^ + | Access uninitialized field value b. Call trace: + | -> object Foo: [ global-list.scala:8 ] + | ^ + | -> val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] + | ^^^ +-- Warning: tests/init-global/neg/global-list.scala:9:40 --------------------------------------------------------------- +9 | val all: List[Foo] = List(O.a, O.b, O.c) + | ^^^ + | Access uninitialized field value c. Call trace: + | -> object Foo: [ global-list.scala:8 ] + | ^ + | -> val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-list.scala b/tests/init-global/neg/global-list.scala index 062cdce5cdca..e9fed153f78f 100644 --- a/tests/init-global/neg/global-list.scala +++ b/tests/init-global/neg/global-list.scala @@ -1,10 +1,10 @@ case class Foo(name: String) -object O: // error +object O: val a = Foo("Apple") val b = Foo("Banana") val c = Foo("Cherry") object Foo: - val all: List[Foo] = List(O.a, O.b, O.c) // error // error // error + val all: List[Foo] = List(O.a, O.b, O.c) // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/global-local-var.check b/tests/init-global/neg/global-local-var.check index e69de29bb2d1..765e727f58e8 100644 --- a/tests/init-global/neg/global-local-var.check +++ b/tests/init-global/neg/global-local-var.check @@ -0,0 +1,13 @@ +-- Warning: tests/init-global/neg/global-local-var.scala:10:6 ---------------------------------------------------------- +10 | B.a + 10 + sum + | ^^^ + | Access uninitialized field value a. Call trace: + | -> object B { [ global-local-var.scala:14 ] + | ^ + | -> val a: Int = A(4).foo() [ global-local-var.scala:15 ] + | ^^^^^^^^^^ + | -> def foo(): Int = { [ global-local-var.scala:2 ] + | ^ + | -> B.a + 10 + sum [ global-local-var.scala:10 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-local-var.scala b/tests/init-global/neg/global-local-var.scala index aa0b000b1970..9db071de5ae8 100644 --- a/tests/init-global/neg/global-local-var.scala +++ b/tests/init-global/neg/global-local-var.scala @@ -7,7 +7,7 @@ class A(x: Int) { sum += i i += 1 - B.a + 10 + sum // error + B.a + 10 + sum } } diff --git a/tests/init-global/neg/global-region1.check b/tests/init-global/neg/global-region1.check index e69de29bb2d1..25a5359e30a2 100644 --- a/tests/init-global/neg/global-region1.check +++ b/tests/init-global/neg/global-region1.check @@ -0,0 +1,11 @@ +-- Warning: tests/init-global/neg/global-region1.scala:3:51 ------------------------------------------------------------ +3 |class D(var y: Int) extends B { def foo(): Int = A.m } + | ^^^ + | Access uninitialized field value m. Call trace: + | -> object A: [ global-region1.scala:6 ] + | ^ + | -> val m: Int = box1.value.foo() [ global-region1.scala:9 ] + | ^^^^^^^^^^^^^^^^ + | -> class D(var y: Int) extends B { def foo(): Int = A.m } [ global-region1.scala:3 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-region1.scala b/tests/init-global/neg/global-region1.scala index 82e50f985fa7..f47e10a06424 100644 --- a/tests/init-global/neg/global-region1.scala +++ b/tests/init-global/neg/global-region1.scala @@ -1,6 +1,6 @@ trait B { def foo(): Int } class C(var x: Int) extends B { def foo(): Int = 20 } -class D(var y: Int) extends B { def foo(): Int = A.m } // error +class D(var y: Int) extends B { def foo(): Int = A.m } class Box(var value: B) object A: diff --git a/tests/init-global/neg/i11262.check b/tests/init-global/neg/i11262.check index e69de29bb2d1..abb72702722c 100644 --- a/tests/init-global/neg/i11262.check +++ b/tests/init-global/neg/i11262.check @@ -0,0 +1,15 @@ +-- Warning: tests/init-global/neg/i11262.scala:1:7 --------------------------------------------------------------------- +1 |object A { val x: String = B.y } + | ^ + | Cyclic initialization: object A -> object B -> object A. Calling trace: + | -> object A { val x: String = B.y } [ i11262.scala:1 ] + | ^ + | -> object B { val y: String = A.x } [ i11262.scala:2 ] + | ^ +-- Warning: tests/init-global/neg/i11262.scala:2:29 -------------------------------------------------------------------- +2 |object B { val y: String = A.x } + | ^^^ + | Access uninitialized field value x. Call trace: + | -> object B { val y: String = A.x } [ i11262.scala:2 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/i11262.scala b/tests/init-global/neg/i11262.scala index 54b29c38e2b2..befc9ca0834d 100644 --- a/tests/init-global/neg/i11262.scala +++ b/tests/init-global/neg/i11262.scala @@ -1,4 +1,4 @@ -object A { val x: String = B.y } // error -object B { val y: String = A.x } // error +object A { val x: String = B.y } +object B { val y: String = A.x } // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/i12544b.check b/tests/init-global/neg/i12544b.check index e69de29bb2d1..fa03c4a2a336 100644 --- a/tests/init-global/neg/i12544b.check +++ b/tests/init-global/neg/i12544b.check @@ -0,0 +1,21 @@ +-- Warning: tests/init-global/neg/i12544b.scala:5:9 -------------------------------------------------------------------- +5 | object nested: + | ^ + | Cyclic initialization: object nested -> object Enum -> object nested. Calling trace: + | -> object nested: [ i12544b.scala:5 ] + | ^ + | -> val a: Enum = Case [ i12544b.scala:6 ] + | ^^^^ + | -> object Enum: [ i12544b.scala:4 ] + | ^ + | -> val b: Enum = f(nested.a) [ i12544b.scala:8 ] + | ^^^^^^ +-- Warning: tests/init-global/neg/i12544b.scala:8:25 ------------------------------------------------------------------- +8 | val b: Enum = f(nested.a) + | ^^^^^^^^ + | Access uninitialized field value a. Call trace: + | -> object Enum: [ i12544b.scala:4 ] + | ^ + | -> val b: Enum = f(nested.a) [ i12544b.scala:8 ] + | ^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/i12544b.scala b/tests/init-global/neg/i12544b.scala index 7128e455386a..759829e3bd75 100644 --- a/tests/init-global/neg/i12544b.scala +++ b/tests/init-global/neg/i12544b.scala @@ -2,10 +2,10 @@ enum Enum: case Case object Enum: - object nested: // error + object nested: val a: Enum = Case - val b: Enum = f(nested.a) // error + val b: Enum = f(nested.a) def f(e: Enum): Enum = e diff --git a/tests/init-global/neg/i9176.check b/tests/init-global/neg/i9176.check index e69de29bb2d1..92f9e31288bc 100644 --- a/tests/init-global/neg/i9176.check +++ b/tests/init-global/neg/i9176.check @@ -0,0 +1,9 @@ +-- Warning: tests/init-global/neg/i9176.scala:2:12 --------------------------------------------------------------------- +2 |case object A extends Foo(B) + | ^ + | Cyclic initialization: object A -> object B -> object A. Calling trace: + | -> case object A extends Foo(B) [ i9176.scala:2 ] + | ^ + | -> case object B extends Foo(A) [ i9176.scala:3 ] + | ^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/i9176.scala b/tests/init-global/neg/i9176.scala index b32ed4febd21..fe1c5388029e 100644 --- a/tests/init-global/neg/i9176.scala +++ b/tests/init-global/neg/i9176.scala @@ -1,5 +1,5 @@ class Foo(val opposite: Foo) -case object A extends Foo(B) // error +case object A extends Foo(B) case object B extends Foo(A) object Test { def main(args: Array[String]): Unit = { diff --git a/tests/init-global/neg/line-spacing.check b/tests/init-global/neg/line-spacing.check index e69de29bb2d1..d67bc7c97527 100644 --- a/tests/init-global/neg/line-spacing.check +++ b/tests/init-global/neg/line-spacing.check @@ -0,0 +1,14 @@ +-- Warning: tests/init-global/neg/line-spacing.scala:4:7 --------------------------------------------------------------- +3 | B +4 | .s.length + | ^ + | Access uninitialized field value s. Call trace: + | -> object B { [ line-spacing.scala:7 ] + | ^ + | -> val s: String = s"${A.a}a" [ line-spacing.scala:8 ] + | ^^^ + | -> def a: Int = [ line-spacing.scala:2 ] + | ^ + | -> .s.length [ line-spacing.scala:4 ] + | ^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/line-spacing.scala b/tests/init-global/neg/line-spacing.scala index 27e55e0177a0..7855e82954b8 100644 --- a/tests/init-global/neg/line-spacing.scala +++ b/tests/init-global/neg/line-spacing.scala @@ -1,7 +1,7 @@ object A { def a: Int = B - .s.length // error + .s.length } object B { diff --git a/tests/init-global/neg/mutable-array.check b/tests/init-global/neg/mutable-array.check index e69de29bb2d1..794ace19f512 100644 --- a/tests/init-global/neg/mutable-array.check +++ b/tests/init-global/neg/mutable-array.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/mutable-array.scala:8:19 ------------------------------------------------------------- +8 | val x: Int = box.value + | ^^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ mutable-array.scala:5 ] + | ^ + |-> val x: Int = box.value [ mutable-array.scala:8 ] + | ^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-array.scala b/tests/init-global/neg/mutable-array.scala index f78e721d1491..4fea9a813423 100644 --- a/tests/init-global/neg/mutable-array.scala +++ b/tests/init-global/neg/mutable-array.scala @@ -5,6 +5,6 @@ object A: object B: val boxes: Array[A.Box] = Array(A.box) val box: A.Box = boxes(0) - val x: Int = box.value // error + val x: Int = box.value // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read1.check b/tests/init-global/neg/mutable-read1.check index e69de29bb2d1..159f01985eea 100644 --- a/tests/init-global/neg/mutable-read1.check +++ b/tests/init-global/neg/mutable-read1.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/mutable-read1.scala:10:20 ------------------------------------------------------------ +10 | val n: Int = boxA.value + | ^^^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ mutable-read1.scala:6 ] + | ^ + |-> val n: Int = boxA.value [ mutable-read1.scala:10 ] + | ^^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read1.scala b/tests/init-global/neg/mutable-read1.scala index a4f6ae972b71..78aa0e1c4ff3 100644 --- a/tests/init-global/neg/mutable-read1.scala +++ b/tests/init-global/neg/mutable-read1.scala @@ -7,5 +7,5 @@ object B: val boxB: Box = new Box(5) val boxA: Box = A.box val m: Int = boxB.value - val n: Int = boxA.value // error + val n: Int = boxA.value // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read2.check b/tests/init-global/neg/mutable-read2.check index e69de29bb2d1..1bb8e07c0429 100644 --- a/tests/init-global/neg/mutable-read2.check +++ b/tests/init-global/neg/mutable-read2.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/mutable-read2.scala:10:19 ------------------------------------------------------------ +10 | val b: Int = box.value + | ^^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ mutable-read2.scala:7 ] + | ^ + |-> val b: Int = box.value [ mutable-read2.scala:10 ] + | ^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read2.scala b/tests/init-global/neg/mutable-read2.scala index 340bc003b5d4..d223de11d801 100644 --- a/tests/init-global/neg/mutable-read2.scala +++ b/tests/init-global/neg/mutable-read2.scala @@ -7,5 +7,5 @@ object A: object B: val box: A.Box = A.box val a: Int = box.initial - val b: Int = box.value // error + val b: Int = box.value // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read3.check b/tests/init-global/neg/mutable-read3.check index e69de29bb2d1..d0e194093f2e 100644 --- a/tests/init-global/neg/mutable-read3.check +++ b/tests/init-global/neg/mutable-read3.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/mutable-read3.scala:9:19 ------------------------------------------------------------- +9 | val x: Int = box.value + | ^^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ mutable-read3.scala:5 ] + | ^ + |-> val x: Int = box.value [ mutable-read3.scala:9 ] + | ^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read3.scala b/tests/init-global/neg/mutable-read3.scala index 46ce43543bb4..d5cf067f7609 100644 --- a/tests/init-global/neg/mutable-read3.scala +++ b/tests/init-global/neg/mutable-read3.scala @@ -6,5 +6,5 @@ object B: val boxes: Array[A.Box] = new Array(1) boxes(0) = A.box val box: A.Box = boxes(0) - val x: Int = box.value // error + val x: Int = box.value // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read4.check b/tests/init-global/neg/mutable-read4.check index e69de29bb2d1..9ed8f6d6c49d 100644 --- a/tests/init-global/neg/mutable-read4.check +++ b/tests/init-global/neg/mutable-read4.check @@ -0,0 +1,10 @@ +-- Warning: tests/init-global/neg/mutable-read4.scala:10:20 ------------------------------------------------------------ +10 | val n: Int = boxA.value + | ^^^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ mutable-read4.scala:6 ] + | ^ + |-> val n: Int = boxA.value [ mutable-read4.scala:10 ] + | ^^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read4.scala b/tests/init-global/neg/mutable-read4.scala index a4f6ae972b71..78aa0e1c4ff3 100644 --- a/tests/init-global/neg/mutable-read4.scala +++ b/tests/init-global/neg/mutable-read4.scala @@ -7,5 +7,5 @@ object B: val boxB: Box = new Box(5) val boxA: Box = A.box val m: Int = boxB.value - val n: Int = boxA.value // error + val n: Int = boxA.value // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/mutable-read5.check b/tests/init-global/neg/mutable-read5.check index e69de29bb2d1..6b84d329188a 100644 --- a/tests/init-global/neg/mutable-read5.check +++ b/tests/init-global/neg/mutable-read5.check @@ -0,0 +1,12 @@ +-- Warning: tests/init-global/neg/mutable-read5.scala:4:38 ------------------------------------------------------------- +4 | def name(s: String): Name = Name(0, chrs.length) + | ^^^^ + |Reading mutable state of object Names during initialization of object StdNames. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object StdNames: [ mutable-read5.scala:6 ] + | ^ + |-> val AnyRef: Names.Name = Names.name("AnyRef") [ mutable-read5.scala:7 ] + | ^^^^^^^^^^^^^^^^^^^^ + |-> def name(s: String): Name = Name(0, chrs.length) [ mutable-read5.scala:4 ] + | ^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read5.scala b/tests/init-global/neg/mutable-read5.scala index 3d5b59236f02..884f027c970e 100644 --- a/tests/init-global/neg/mutable-read5.scala +++ b/tests/init-global/neg/mutable-read5.scala @@ -1,7 +1,7 @@ object Names: class Name(val start: Int, val length: Int) var chrs: Array[Char] = new Array[Char](0x20000) - def name(s: String): Name = Name(0, chrs.length) // error + def name(s: String): Name = Name(0, chrs.length) object StdNames: val AnyRef: Names.Name = Names.name("AnyRef") diff --git a/tests/init-global/neg/mutable-read6.check b/tests/init-global/neg/mutable-read6.check index e69de29bb2d1..ceb2928ba654 100644 --- a/tests/init-global/neg/mutable-read6.check +++ b/tests/init-global/neg/mutable-read6.check @@ -0,0 +1,12 @@ +-- Warning: tests/init-global/neg/mutable-read6.scala:7:35 ------------------------------------------------------------- +7 | final def source: SourceFile = _source + | ^^^^^^^ + |Reading mutable state of object Contexts during initialization of object Implicits. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object Implicits: [ mutable-read6.scala:12 ] + | ^ + |-> val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source) [ mutable-read6.scala:15 ] + | ^^^^^^^^^^^^^^^^ + |-> final def source: SourceFile = _source [ mutable-read6.scala:7 ] + | ^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read6.scala b/tests/init-global/neg/mutable-read6.scala index 852d5c7de9cb..ce6034769f60 100644 --- a/tests/init-global/neg/mutable-read6.scala +++ b/tests/init-global/neg/mutable-read6.scala @@ -4,7 +4,7 @@ object Contexts: val NoContext: Context = new Context class Context: private var _source: SourceFile = null - final def source: SourceFile = _source // error + final def source: SourceFile = _source def setSource(source: SourceFile) = { this._source = source } diff --git a/tests/init-global/neg/mutable-read7.check b/tests/init-global/neg/mutable-read7.check index e69de29bb2d1..fd7139b14b19 100644 --- a/tests/init-global/neg/mutable-read7.check +++ b/tests/init-global/neg/mutable-read7.check @@ -0,0 +1,16 @@ +-- Warning: tests/init-global/neg/mutable-read7.scala:7:17 ------------------------------------------------------------- +7 | if (Positioned.debug) { + | ^^^^^^^^^^^^^^^^ + |Reading mutable state of object Positioned during initialization of object Trees. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object Trees: [ mutable-read7.scala:11 ] + | ^ + |-> val emptyTree = new Tree [ mutable-read7.scala:13 ] + | ^^^^^^^^ + |-> class Tree extends Positioned [ mutable-read7.scala:12 ] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + |-> abstract class Positioned: [ mutable-read7.scala:6 ] + | ^ + |-> if (Positioned.debug) { [ mutable-read7.scala:7 ] + | ^^^^^^^^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read7.scala b/tests/init-global/neg/mutable-read7.scala index 7084b4a17566..b840bdc11a5d 100644 --- a/tests/init-global/neg/mutable-read7.scala +++ b/tests/init-global/neg/mutable-read7.scala @@ -4,7 +4,7 @@ object Positioned: var nextId: Int = 0 abstract class Positioned: - if (Positioned.debug) { // error + if (Positioned.debug) { println("do debugging") } diff --git a/tests/init-global/neg/mutable-read8.check b/tests/init-global/neg/mutable-read8.check index e69de29bb2d1..3598228f24a9 100644 --- a/tests/init-global/neg/mutable-read8.check +++ b/tests/init-global/neg/mutable-read8.check @@ -0,0 +1,14 @@ +-- Warning: tests/init-global/neg/mutable-read8.scala:6:12 ------------------------------------------------------------- +6 | if (Stats.monitored) println("record stats") + | ^^^^^^^^^^^^^^^ + |Reading mutable state of object Stats during initialization of object NoCompleter. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object NoCompleter extends LazyType [ mutable-read8.scala:11 ] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + |-> class LazyType extends UncachedGroundType [ mutable-read8.scala:9 ] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + |-> class UncachedGroundType { [ mutable-read8.scala:5 ] + | ^ + |-> if (Stats.monitored) println("record stats") [ mutable-read8.scala:6 ] + | ^^^^^^^^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read8.scala b/tests/init-global/neg/mutable-read8.scala index 7cf991aabaa4..0e84fe534b26 100644 --- a/tests/init-global/neg/mutable-read8.scala +++ b/tests/init-global/neg/mutable-read8.scala @@ -3,7 +3,7 @@ object Stats { } class UncachedGroundType { - if (Stats.monitored) println("record stats") // error + if (Stats.monitored) println("record stats") } class LazyType extends UncachedGroundType diff --git a/tests/init-global/neg/partial-ordering.check b/tests/init-global/neg/partial-ordering.check index e69de29bb2d1..5db1fdc9d873 100644 --- a/tests/init-global/neg/partial-ordering.check +++ b/tests/init-global/neg/partial-ordering.check @@ -0,0 +1,13 @@ +-- Warning: tests/init-global/neg/partial-ordering.scala:1:7 ----------------------------------------------------------- +1 |object Names: + | ^ + | Cyclic initialization: object Names -> object MethodName -> object Names. Calling trace: + | -> object Names: [ partial-ordering.scala:1 ] + | ^ + | -> val ctorName: MethodName = MethodName.apply(ctorString) [ partial-ordering.scala:3 ] + | ^^^^^^^^^^ + | -> object MethodName: [ partial-ordering.scala:6 ] + | ^ + | -> val ctor: MethodName = new MethodName(Names.ctorString) [ partial-ordering.scala:7 ] + | ^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/partial-ordering.scala b/tests/init-global/neg/partial-ordering.scala index b3d32da1bc14..7cc1333706a9 100644 --- a/tests/init-global/neg/partial-ordering.scala +++ b/tests/init-global/neg/partial-ordering.scala @@ -1,4 +1,4 @@ -object Names: // error +object Names: val ctorString = "" val ctorName: MethodName = MethodName.apply(ctorString) diff --git a/tests/init-global/neg/patmat-unapplySeq.check b/tests/init-global/neg/patmat-unapplySeq.check index e69de29bb2d1..f5f3fb1c0d8f 100644 --- a/tests/init-global/neg/patmat-unapplySeq.check +++ b/tests/init-global/neg/patmat-unapplySeq.check @@ -0,0 +1,12 @@ +-- Warning: tests/init-global/neg/patmat-unapplySeq.scala:8:32 --------------------------------------------------------- +8 | def apply(i: Int): Box = array(i) + | ^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ patmat-unapplySeq.scala:15 ] + | ^ + |-> case A(b) => [ patmat-unapplySeq.scala:17 ] + | ^^^^ + |-> def apply(i: Int): Box = array(i) [ patmat-unapplySeq.scala:8 ] + | ^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/patmat-unapplySeq.scala b/tests/init-global/neg/patmat-unapplySeq.scala index 0169f898d5f9..3f0f1c60c801 100644 --- a/tests/init-global/neg/patmat-unapplySeq.scala +++ b/tests/init-global/neg/patmat-unapplySeq.scala @@ -5,7 +5,7 @@ object A: array(0) = new Box(10) def length: Int = array.length - def apply(i: Int): Box = array(i) // error + def apply(i: Int): Box = array(i) def drop(n: Int): Seq[Box] = array.toSeq def toSeq: Seq[Box] = array.toSeq diff --git a/tests/init-global/neg/patmat-unapplySeq2.check b/tests/init-global/neg/patmat-unapplySeq2.check index e69de29bb2d1..a545af8e9dee 100644 --- a/tests/init-global/neg/patmat-unapplySeq2.check +++ b/tests/init-global/neg/patmat-unapplySeq2.check @@ -0,0 +1,12 @@ +-- Warning: tests/init-global/neg/patmat-unapplySeq2.scala:8:32 -------------------------------------------------------- +8 | def apply(i: Int): Box = array(i) + | ^^^^^^^^ + |Reading mutable state of object A during initialization of object B. + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |-> object B: [ patmat-unapplySeq2.scala:15 ] + | ^ + |-> case A(b*) => [ patmat-unapplySeq2.scala:17 ] + | ^^^^^ + |-> def apply(i: Int): Box = array(i) [ patmat-unapplySeq2.scala:8 ] + | ^^^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/patmat-unapplySeq2.scala b/tests/init-global/neg/patmat-unapplySeq2.scala index 059f53f4c812..c890a09efd2e 100644 --- a/tests/init-global/neg/patmat-unapplySeq2.scala +++ b/tests/init-global/neg/patmat-unapplySeq2.scala @@ -5,7 +5,7 @@ object A: array(0) = new Box(10) def length: Int = array.length - def apply(i: Int): Box = array(i) // error + def apply(i: Int): Box = array(i) def drop(n: Int): Seq[Box] = array.toSeq def toSeq: Seq[Box] = array.toSeq diff --git a/tests/init-global/neg/patmat.check b/tests/init-global/neg/patmat.check index e69de29bb2d1..9c77fb554aae 100644 --- a/tests/init-global/neg/patmat.check +++ b/tests/init-global/neg/patmat.check @@ -0,0 +1,27 @@ +-- Warning: tests/init-global/neg/patmat.scala:1:7 --------------------------------------------------------------------- +1 |object A: + | ^ + | Cyclic initialization: object A -> object B -> object A. Calling trace: + | -> object A: [ patmat.scala:1 ] + | ^ + | -> case Some(x) => println(x * 2 + B.a.size) [ patmat.scala:4 ] + | ^ + | -> object B: [ patmat.scala:7 ] + | ^ + | -> if A.a.isEmpty then println(xs.size) [ patmat.scala:12 ] + | ^ +-- Warning: tests/init-global/neg/patmat.scala:29:9 -------------------------------------------------------------------- +29 | object Inner: + | ^ + | Cyclic initialization: object Inner -> object C -> object Inner. Calling trace: + | -> object Inner: [ patmat.scala:29 ] + | ^ + | -> case Box(f) => f() [ patmat.scala:35 ] + | ^^^ + | -> val foo: () => Int = () => C.a [ patmat.scala:32 ] + | ^ + | -> object C: [ patmat.scala:18 ] + | ^ + | -> val a: Int = Inner.b [ patmat.scala:27 ] + | ^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/patmat.scala b/tests/init-global/neg/patmat.scala index 1c817d0af63d..05f6ea0cdbac 100644 --- a/tests/init-global/neg/patmat.scala +++ b/tests/init-global/neg/patmat.scala @@ -1,4 +1,4 @@ -object A: // error +object A: val a: Option[Int] = Some(3) a match case Some(x) => println(x * 2 + B.a.size) @@ -26,7 +26,7 @@ object C: val a: Int = Inner.b - object Inner: // error + object Inner: val b: Int = 10 val foo: () => Int = () => C.a diff --git a/tests/init-global/neg/return.check b/tests/init-global/neg/return.check index e69de29bb2d1..158913326a9a 100644 --- a/tests/init-global/neg/return.check +++ b/tests/init-global/neg/return.check @@ -0,0 +1,11 @@ +-- Warning: tests/init-global/neg/return.scala:4:31 -------------------------------------------------------------------- +4 | return (a: Int) => a + B.n + | ^^^ + | Access uninitialized field value n. Call trace: + | -> object B: [ return.scala:8 ] + | ^ + | -> val n = A.foo(-10)(20) [ return.scala:9 ] + | ^^^^^^^^^^^^^^ + | -> return (a: Int) => a + B.n [ return.scala:4 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/return.scala b/tests/init-global/neg/return.scala index e493c830f60f..442b0f200f45 100644 --- a/tests/init-global/neg/return.scala +++ b/tests/init-global/neg/return.scala @@ -1,7 +1,7 @@ object A: def foo(x: Int): Int => Int = if x <= 0 then - return (a: Int) => a + B.n // error + return (a: Int) => a + B.n (a: Int) => a * a + x diff --git a/tests/init-global/neg/return2.check b/tests/init-global/neg/return2.check index e69de29bb2d1..5f2f9fb3cbab 100644 --- a/tests/init-global/neg/return2.check +++ b/tests/init-global/neg/return2.check @@ -0,0 +1,15 @@ +-- Warning: tests/init-global/neg/return2.scala:3:30 ------------------------------------------------------------------- +3 | val f = (a: Int) => a + B.n + | ^^^ + | Access uninitialized field value n. Call trace: + | -> object B: [ return2.scala:12 ] + | ^ + | -> val n = A.foo(-10)(20) [ return2.scala:13 ] + | ^^^^^^^^^^^^^^ + | -> val f = (a: Int) => a + B.n [ return2.scala:3 ] + | ^^^ +-- Warning: tests/init-global/neg/return2.scala:6:18 ------------------------------------------------------------------- +6 | val g = () => return f + | ^^^^^^^^ + | Non local returns are no longer supported; use `boundary` and `boundary.break` in `scala.util` instead +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/return2.scala b/tests/init-global/neg/return2.scala index d8dcfb0b05cc..3c93fe9120c6 100644 --- a/tests/init-global/neg/return2.scala +++ b/tests/init-global/neg/return2.scala @@ -1,6 +1,6 @@ object A: def foo(x: Int): Int => Int = - val f = (a: Int) => a + B.n // error + val f = (a: Int) => a + B.n var i = 0 val g = () => return f diff --git a/tests/init-global/neg/t5366.check b/tests/init-global/neg/t5366.check index e69de29bb2d1..01db17c85f8e 100644 --- a/tests/init-global/neg/t5366.check +++ b/tests/init-global/neg/t5366.check @@ -0,0 +1,21 @@ +-- Warning: tests/init-global/neg/t5366.scala:3:12 --------------------------------------------------------------------- +3 |case object ObjA extends IdAndMsg(1) + | ^ + | Cyclic initialization: object ObjA -> object IdAndMsg -> object ObjA. Calling trace: + | -> case object ObjA extends IdAndMsg(1) [ t5366.scala:3 ] + | ^ + | -> object IdAndMsg { [ t5366.scala:6 ] + | ^ + | -> val values = List(ObjA , ObjB) [ t5366.scala:7 ] + | ^^^^ +-- Warning: tests/init-global/neg/t5366.scala:6:7 ---------------------------------------------------------------------- +6 |object IdAndMsg { + | ^ + | Cyclic initialization: object IdAndMsg -> object ObjB -> object IdAndMsg. Calling trace: + | -> object IdAndMsg { [ t5366.scala:6 ] + | ^ + | -> val values = List(ObjA , ObjB) [ t5366.scala:7 ] + | ^^^^ + | -> case object ObjB extends IdAndMsg(2) [ t5366.scala:4 ] + | ^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/t5366.scala b/tests/init-global/neg/t5366.scala index d358f1cfb04d..2283b79bfb8f 100644 --- a/tests/init-global/neg/t5366.scala +++ b/tests/init-global/neg/t5366.scala @@ -1,9 +1,9 @@ class IdAndMsg(val id: Int, val msg: String = "") -case object ObjA extends IdAndMsg(1) // error +case object ObjA extends IdAndMsg(1) case object ObjB extends IdAndMsg(2) -object IdAndMsg { // error +object IdAndMsg { val values = List(ObjA , ObjB) } diff --git a/tests/init-global/neg/t9115.check b/tests/init-global/neg/t9115.check index e69de29bb2d1..bd90efaf526d 100644 --- a/tests/init-global/neg/t9115.check +++ b/tests/init-global/neg/t9115.check @@ -0,0 +1,21 @@ +-- Warning: tests/init-global/neg/t9115.scala:4:14 --------------------------------------------------------------------- +4 | case object D1 extends Z(aaa) + | ^ + | Cyclic initialization: object D1 -> object D -> object D1. Calling trace: + | -> case object D1 extends Z(aaa) [ t9115.scala:4 ] + | ^^^ + | -> object D { [ t9115.scala:1 ] + | ^ + | -> println(D1) [ t9115.scala:6 ] + | ^^ +-- Warning: tests/init-global/neg/t9115.scala:1:7 ---------------------------------------------------------------------- +1 |object D { + | ^ + | Cyclic initialization: object D -> object D2 -> object D. Calling trace: + | -> object D { [ t9115.scala:1 ] + | ^ + | -> println(D2) [ t9115.scala:7 ] + | ^^ + | -> case object D2 extends Z(aaa) // 'null' when calling D.D2 first time [ t9115.scala:5 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/t9115.scala b/tests/init-global/neg/t9115.scala index 253cfe289d7d..aa9573554260 100644 --- a/tests/init-global/neg/t9115.scala +++ b/tests/init-global/neg/t9115.scala @@ -1,7 +1,7 @@ -object D { // error +object D { def aaa = 1 //that’s the reason class Z (depends: Any) - case object D1 extends Z(aaa) // 'null' when calling D.D1 first time // error + case object D1 extends Z(aaa) case object D2 extends Z(aaa) // 'null' when calling D.D2 first time println(D1) println(D2) diff --git a/tests/init-global/neg/t9261.check b/tests/init-global/neg/t9261.check index e69de29bb2d1..79dc40d0351c 100644 --- a/tests/init-global/neg/t9261.check +++ b/tests/init-global/neg/t9261.check @@ -0,0 +1,9 @@ +-- Warning: tests/init-global/neg/t9261.scala:2:12 --------------------------------------------------------------------- +2 |case object Buy extends OrderType(Sell) + | ^ + | Cyclic initialization: object Buy -> object Sell -> object Buy. Calling trace: + | -> case object Buy extends OrderType(Sell) [ t9261.scala:2 ] + | ^^^^ + | -> case object Sell extends OrderType(Buy) [ t9261.scala:3 ] + | ^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/t9261.scala b/tests/init-global/neg/t9261.scala index 12f4f8facdbf..9eb7f255492c 100644 --- a/tests/init-global/neg/t9261.scala +++ b/tests/init-global/neg/t9261.scala @@ -1,5 +1,5 @@ sealed abstract class OrderType(val reverse: OrderType) -case object Buy extends OrderType(Sell) // error +case object Buy extends OrderType(Sell) case object Sell extends OrderType(Buy) // nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/init-global/neg/t9312.check b/tests/init-global/neg/t9312.check index e69de29bb2d1..4a6e733dd148 100644 --- a/tests/init-global/neg/t9312.check +++ b/tests/init-global/neg/t9312.check @@ -0,0 +1,29 @@ +-- Warning: tests/init-global/neg/t9312.scala:18:11 -------------------------------------------------------------------- +18 | object Child1 extends Child + | ^ + | Cyclic initialization: object Child1 -> object Parent -> object Child1. Calling trace: + | -> object Child1 extends Child [ t9312.scala:18 ] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | -> trait Child { [ t9312.scala:12 ] + | ^ + | -> val parent = Parent [ t9312.scala:14 ] + | ^^^^^^ + | -> object Parent { [ t9312.scala:11 ] + | ^ + | -> final val children = Set(Child1, Child2) [ t9312.scala:21 ] + | ^^^^^^ +-- Warning: tests/init-global/neg/t9312.scala:11:9 --------------------------------------------------------------------- +11 | object Parent { + | ^ + | Cyclic initialization: object Parent -> object Child2 -> object Parent. Calling trace: + | -> object Parent { [ t9312.scala:11 ] + | ^ + | -> final val children = Set(Child1, Child2) [ t9312.scala:21 ] + | ^^^^^^ + | -> object Child2 extends Child [ t9312.scala:19 ] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | -> trait Child { [ t9312.scala:12 ] + | ^ + | -> val parent = Parent [ t9312.scala:14 ] + | ^^^^^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/t9312.scala b/tests/init-global/neg/t9312.scala index f9d8eae56b4a..7dc9af580162 100644 --- a/tests/init-global/neg/t9312.scala +++ b/tests/init-global/neg/t9312.scala @@ -8,14 +8,14 @@ object DeadLockTest { } - object Parent { // error + object Parent { trait Child { Thread.sleep(2000) // ensure concurrent behavior val parent = Parent def siblings = parent.children - this } - object Child1 extends Child // error + object Child1 extends Child object Child2 extends Child final val children = Set(Child1, Child2) diff --git a/tests/init-global/neg/t9360.check b/tests/init-global/neg/t9360.check index e69de29bb2d1..e27ea4d5d26b 100644 --- a/tests/init-global/neg/t9360.check +++ b/tests/init-global/neg/t9360.check @@ -0,0 +1,21 @@ +-- Warning: tests/init-global/neg/t9360.scala:8:9 ---------------------------------------------------------------------- +8 | object AObj extends BaseClass(s) + | ^ + | Cyclic initialization: object AObj -> object Obj -> object AObj. Calling trace: + | -> object AObj extends BaseClass(s) [ t9360.scala:8 ] + | ^ + | -> object Obj { [ t9360.scala:5 ] + | ^ + | -> val list = List(AObj, BObj) [ t9360.scala:12 ] + | ^^^^ +-- Warning: tests/init-global/neg/t9360.scala:5:7 ---------------------------------------------------------------------- +5 |object Obj { + | ^ + | Cyclic initialization: object Obj -> object BObj -> object Obj. Calling trace: + | -> object Obj { [ t9360.scala:5 ] + | ^ + | -> val list = List(AObj, BObj) [ t9360.scala:12 ] + | ^^^^ + | -> object BObj extends BaseClass(s) [ t9360.scala:10 ] + | ^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/t9360.scala b/tests/init-global/neg/t9360.scala index 29b1a1fd4ae9..0fca843cd01d 100644 --- a/tests/init-global/neg/t9360.scala +++ b/tests/init-global/neg/t9360.scala @@ -2,10 +2,10 @@ class BaseClass(s: String) { def print: Unit = () } -object Obj { // error +object Obj { val s: String = "hello" - object AObj extends BaseClass(s) // error + object AObj extends BaseClass(s) object BObj extends BaseClass(s) diff --git a/tests/init-global/neg/unapply-implicit-arg.check b/tests/init-global/neg/unapply-implicit-arg.check index e69de29bb2d1..8d4e1d9c9aa2 100644 --- a/tests/init-global/neg/unapply-implicit-arg.check +++ b/tests/init-global/neg/unapply-implicit-arg.check @@ -0,0 +1,9 @@ +-- Warning: tests/init-global/neg/unapply-implicit-arg.scala:11:16 ----------------------------------------------------- +11 | val i2: Int = i2 match + | ^^ + | Access uninitialized field value i2. Call trace: + | -> object Bar { [ unapply-implicit-arg.scala:1 ] + | ^ + | -> val i2: Int = i2 match [ unapply-implicit-arg.scala:11 ] + | ^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapply-implicit-arg.scala b/tests/init-global/neg/unapply-implicit-arg.scala index b963cbe38313..dd8d03821d0a 100644 --- a/tests/init-global/neg/unapply-implicit-arg.scala +++ b/tests/init-global/neg/unapply-implicit-arg.scala @@ -8,7 +8,7 @@ object Bar { given Foo = new Foo val i1: Int = 0 - val i2: Int = i2 match // error + val i2: Int = i2 match case Bar(i) => i case _ => 0 } diff --git a/tests/init-global/neg/unapply-implicit-arg2.check b/tests/init-global/neg/unapply-implicit-arg2.check index e69de29bb2d1..3d045e1b92a7 100644 --- a/tests/init-global/neg/unapply-implicit-arg2.check +++ b/tests/init-global/neg/unapply-implicit-arg2.check @@ -0,0 +1,13 @@ +-- Warning: tests/init-global/neg/unapply-implicit-arg2.scala:7:51 ----------------------------------------------------- +7 | if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) + | ^^ + | Access uninitialized field value i2. Call trace: + | -> object Bar { [ unapply-implicit-arg2.scala:1 ] + | ^ + | -> case Bar(i) => i [ unapply-implicit-arg2.scala:12 ] + | ^^^^^^ + | -> def unapply(using f1: Foo)(i: Int): Option[Int] = [ unapply-implicit-arg2.scala:6 ] + | ^ + | -> if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) [ unapply-implicit-arg2.scala:7 ] + | ^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapply-implicit-arg2.scala b/tests/init-global/neg/unapply-implicit-arg2.scala index 56ac8afef5ed..b180e5eee495 100644 --- a/tests/init-global/neg/unapply-implicit-arg2.scala +++ b/tests/init-global/neg/unapply-implicit-arg2.scala @@ -4,7 +4,7 @@ object Bar { def m2(i: Int) = i+2 } def unapply(using f1: Foo)(i: Int): Option[Int] = - if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) // error + if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) given Foo = new Foo val i1: Int = 0 diff --git a/tests/init-global/neg/unapply-implicit-arg3.check b/tests/init-global/neg/unapply-implicit-arg3.check index e69de29bb2d1..f402063704ff 100644 --- a/tests/init-global/neg/unapply-implicit-arg3.check +++ b/tests/init-global/neg/unapply-implicit-arg3.check @@ -0,0 +1,15 @@ +-- Warning: tests/init-global/neg/unapply-implicit-arg3.scala:4:25 ----------------------------------------------------- +4 | def m2(i: Int) = i + i2 + | ^^ + | Access uninitialized field value i2. Call trace: + | -> object Bar { [ unapply-implicit-arg3.scala:1 ] + | ^ + | -> case Bar(i) => i [ unapply-implicit-arg3.scala:12 ] + | ^^^^^^ + | -> def unapply(using f1: Foo)(i: Int): Option[Int] = [ unapply-implicit-arg3.scala:6 ] + | ^ + | -> if i == 0 then Some(f1.m1(i)) else Some(f1.m2(i)) [ unapply-implicit-arg3.scala:7 ] + | ^^^^^^^^ + | -> def m2(i: Int) = i + i2 [ unapply-implicit-arg3.scala:4 ] + | ^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapply-implicit-arg3.scala b/tests/init-global/neg/unapply-implicit-arg3.scala index 89972fa4a277..3bf923eeeb4e 100644 --- a/tests/init-global/neg/unapply-implicit-arg3.scala +++ b/tests/init-global/neg/unapply-implicit-arg3.scala @@ -1,7 +1,7 @@ object Bar { class Foo { def m1(i: Int) = i + i1 - def m2(i: Int) = i + i2 // error + def m2(i: Int) = i + i2 } def unapply(using f1: Foo)(i: Int): Option[Int] = if i == 0 then Some(f1.m1(i)) else Some(f1.m2(i)) diff --git a/tests/init-global/neg/unapplySeq-implicit-arg.check b/tests/init-global/neg/unapplySeq-implicit-arg.check index e69de29bb2d1..869d0b38f2f6 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg.check +++ b/tests/init-global/neg/unapplySeq-implicit-arg.check @@ -0,0 +1,9 @@ +-- Warning: tests/init-global/neg/unapplySeq-implicit-arg.scala:11:20 -------------------------------------------------- +11 | val i2: Int = Seq(i2) match + | ^^ + | Access uninitialized field value i2. Call trace: + | -> object Bar { [ unapplySeq-implicit-arg.scala:1 ] + | ^ + | -> val i2: Int = Seq(i2) match [ unapplySeq-implicit-arg.scala:11 ] + | ^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapplySeq-implicit-arg.scala b/tests/init-global/neg/unapplySeq-implicit-arg.scala index 4ed854a9dd20..1ec3ab6fa79a 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg.scala +++ b/tests/init-global/neg/unapplySeq-implicit-arg.scala @@ -8,7 +8,7 @@ object Bar { given Foo = new Foo val i1: Int = 0 - val i2: Int = Seq(i2) match // error + val i2: Int = Seq(i2) match case Bar(i) => i case _ => 0 } diff --git a/tests/init-global/neg/unapplySeq-implicit-arg2.check b/tests/init-global/neg/unapplySeq-implicit-arg2.check index e69de29bb2d1..bda9e4266f3c 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg2.check +++ b/tests/init-global/neg/unapplySeq-implicit-arg2.check @@ -0,0 +1,13 @@ +-- Warning: tests/init-global/neg/unapplySeq-implicit-arg2.scala:4:9 --------------------------------------------------- +4 | Some(i1 +: seqi) + | ^^ + |Access uninitialized field value i1. Call trace: + |-> object Bar { [ unapplySeq-implicit-arg2.scala:1 ] + | ^ + |-> case Bar(i) => i [ unapplySeq-implicit-arg2.scala:7 ] + | ^^^^^^ + |-> def unapplySeq(using f1: Foo)(using f2: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = [ unapplySeq-implicit-arg2.scala:3 ] + | ^ + |-> Some(i1 +: seqi) [ unapplySeq-implicit-arg2.scala:4 ] + | ^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapplySeq-implicit-arg2.scala b/tests/init-global/neg/unapplySeq-implicit-arg2.scala index c598fe849b81..7a48651a3a7a 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg2.scala +++ b/tests/init-global/neg/unapplySeq-implicit-arg2.scala @@ -1,7 +1,7 @@ object Bar { class Foo def unapplySeq(using f1: Foo)(using f2: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = - Some(i1 +: seqi) // error + Some(i1 +: seqi) given Foo = new Foo val i1: Int = Seq(0) match { case Bar(i) => i diff --git a/tests/init-global/neg/unapplySeq-implicit-arg3.check b/tests/init-global/neg/unapplySeq-implicit-arg3.check index e69de29bb2d1..abf11f0bafec 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg3.check +++ b/tests/init-global/neg/unapplySeq-implicit-arg3.check @@ -0,0 +1,15 @@ +-- Warning: tests/init-global/neg/unapplySeq-implicit-arg3.scala:3:27 -------------------------------------------------- +3 | def m(seq: Seq[Int]) = i1 +: seq + | ^^ + |Access uninitialized field value i1. Call trace: + |-> object Bar { [ unapplySeq-implicit-arg3.scala:1 ] + | ^ + |-> case Bar(i, _) => i [ unapplySeq-implicit-arg3.scala:9 ] + | ^^^^^^^^^ + |-> def unapplySeq(using f1: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = [ unapplySeq-implicit-arg3.scala:5 ] + | ^ + |-> Some(f1.m(seqi)) [ unapplySeq-implicit-arg3.scala:6 ] + | ^^^^^^^^^^ + |-> def m(seq: Seq[Int]) = i1 +: seq [ unapplySeq-implicit-arg3.scala:3 ] + | ^^ +No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapplySeq-implicit-arg3.scala b/tests/init-global/neg/unapplySeq-implicit-arg3.scala index 1e1b5a5116b0..9efcac577bd3 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg3.scala +++ b/tests/init-global/neg/unapplySeq-implicit-arg3.scala @@ -1,6 +1,6 @@ object Bar { class Foo { - def m(seq: Seq[Int]) = i1 +: seq // error + def m(seq: Seq[Int]) = i1 +: seq } def unapplySeq(using f1: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = Some(f1.m(seqi)) diff --git a/tests/warn/gadt-contradictory-pattern.scala b/tests/warn/gadt-contradictory-pattern.scala index b9c004efbe34..5d85b23653db 100644 --- a/tests/warn/gadt-contradictory-pattern.scala +++ b/tests/warn/gadt-contradictory-pattern.scala @@ -5,7 +5,7 @@ object Test { case object Bar2 extends Foo[String] case object Bar3 extends Foo[AnyRef] - def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match { + def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match { // warn match may not be exhaustive case (Bar1, Bar1) => () // warn // warn case (Bar2, Bar3) => () case (Bar3, _) => () diff --git a/tests/warn/i12253.scala b/tests/warn/i12253.scala index 313ef4584098..d632de7c43f4 100644 --- a/tests/warn/i12253.scala +++ b/tests/warn/i12253.scala @@ -27,3 +27,5 @@ object MacroUtils: end Extractors end MacroUtils + +// nopos-warn deprecation \ No newline at end of file diff --git a/tests/warn/i15503d.scala b/tests/warn/i15503d.scala index 5cda54fc5c42..9a0ba9b2f8dc 100644 --- a/tests/warn/i15503d.scala +++ b/tests/warn/i15503d.scala @@ -11,12 +11,12 @@ val a = Sum(S(S(Z)),Z) match { case Sum(a,Z) => Z // warn // case Sum(a @ _,Z) => Z // todo : this should pass in the future case Sum(a@S(_),Z) => Z // warn - case Sum(a@S(_),Z) => a // OK + case Sum(a@S(_),Z) => a // warn unreachable case Sum(a@S(b@S(_)), Z) => a // warn case Sum(a@S(b@S(_)), Z) => a // warn - case Sum(a@S(b@(S(_))), Z) => Sum(a,b) // OK + case Sum(a@S(b@(S(_))), Z) => Sum(a,b) // warn unreachable case Sum(_,_) => Z // OK - case _ => Z // OK + case _ => Z // warn unreachable } // todo : This should pass in the future diff --git a/tests/warn/i16639a.scala b/tests/warn/i16639a.scala index 71812e23f636..21b46921624e 100644 --- a/tests/warn/i16639a.scala +++ b/tests/warn/i16639a.scala @@ -1,7 +1,7 @@ //> using options -Wunused:all // class Bippy(a: Int, b: Int) { - private def this(c: Int) = this(c, c) // warn /Dotty:NoWarn + private def this(c: Int) = this(c, c) private def boop(x: Int) = x+a+b // warn private def bippy(x: Int): Int = bippy(x) // warn TODO: could warn final private val MILLIS1 = 2000 // warn no warn, /Dotty:Warn @@ -45,7 +45,7 @@ trait Accessors { class StableAccessors { private var s1: Int = 0 // warn warn private var s2: Int = 0 // warn warn, never set - private var s3: Int = 0 // warn, never got /Dotty: no warn even if not usued + private var s3: Int = 0 private var s4: Int = 0 // no warn private[this] var s5 = 0 // warn warn, never set @@ -62,7 +62,6 @@ class StableAccessors { } trait DefaultArgs { - // warn about default getters for x2 and x3 private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3 // no more warn warn since #17061 def boppy() = bippy(5, 100, 200) diff --git a/tests/neg/i17613b/i17613b.scala b/tests/warn/i17613b/i17613b.scala similarity index 87% rename from tests/neg/i17613b/i17613b.scala rename to tests/warn/i17613b/i17613b.scala index a5c0eaacc20f..bf057f92837b 100644 --- a/tests/neg/i17613b/i17613b.scala +++ b/tests/warn/i17613b/i17613b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Xlint:type-parameter-shadow +//> using options -Xlint:type-parameter-shadow object i17613b: import importTry._ @@ -12,7 +12,7 @@ object i17613b: def foobar2[ImClass](in: D) = in.toString // warn type MySeq2[ImClass] = Seq[D] // warn - given [A]: Ordering[Int]() // error + given [A]: Ordering[Int]() type TypeLambda[A] = [ImTrait] =>> Map[ImTrait, B] type PolyFun[A] = [ImTrait] => ImTrait => B // warn type MatchType[A] = A match { @@ -42,4 +42,3 @@ object i17613b: 5 def main(args: Array[String]) = println("Test for type parameter shadow") -// nopos-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/i17613b/importTry.scala b/tests/warn/i17613b/importTry.scala similarity index 100% rename from tests/neg/i17613b/importTry.scala rename to tests/warn/i17613b/importTry.scala diff --git a/tests/warn/nonunit-statement.scala b/tests/warn/nonunit-statement.scala index 297a1063cb4d..13dafb43ab86 100644 --- a/tests/warn/nonunit-statement.scala +++ b/tests/warn/nonunit-statement.scala @@ -50,7 +50,7 @@ class Absolution { // Future(42): Unit // nowarn { F(42)(ctx) }: Unit where annot is on F(42) // f(42): Unit // nowarn } -// warn uni-branched unless user disables it with -Wnonunit-if:false + class Boxed[A](a: A) { def isEmpty = false def foreach[U](f: A => U): Unit = From 2c0528af930a02f4c5415d2bdb85b7279f45d014 Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Thu, 9 Nov 2023 18:16:21 +0100 Subject: [PATCH 07/11] Fixed all tests but the compiler crashes --- tests/neg/18493.check | 9 --- tests/neg/i17613b.check | 67 ++++++++++--------- tests/{warn => neg}/i17613b/i17613b.scala | 11 +-- tests/{warn => neg}/i17613b/importTry.scala | 0 tests/{neg => warn}/15981.check | 3 +- tests/{neg => warn}/17284.check | 7 +- tests/warn/18493.check | 8 +++ tests/{neg => warn}/i11022.check | 11 ++- tests/{neg => warn}/i11333.check | 13 ++-- tests/{neg => warn}/i12253.check | 5 +- tests/{neg => warn}/i13440.check | 7 +- tests/{neg => warn}/i16649-refutable.check | 3 +- tests/{neg => warn}/i16728.check | 3 +- tests/{neg => warn}/i17266.check | 19 +++--- tests/{neg => warn}/i17612a.check | 17 +++-- tests/{neg => warn}/i17613a.check | 15 ++--- tests/{neg => warn}/i18722.check | 9 ++- tests/{neg => warn}/i4008.check | 17 +++-- tests/{neg => warn}/i4812.check | 15 ++--- tests/{neg => warn}/i4986b.check | 17 +++-- tests/{neg => warn}/i6190b.check | 3 +- tests/{neg => warn}/i9266.check | 3 +- tests/{neg => warn}/i9408a.check | 13 ++-- tests/{neg => warn}/i9740.check | 5 +- .../{neg => warn}/manifest-summoning-b.check | 5 +- .../refutable-pattern-binding-messages.check | 13 ++-- tests/{neg => warn}/rewrite-messages.check | 5 +- .../scala2-t11681.scala | 6 +- tests/{neg => warn}/symbolic-packages.check | 9 ++- tests/{neg => warn}/t3235-minimal.check | 9 ++- tests/{neg => warn}/warn-value-discard.check | 11 ++- .../with-type-operator-future-migration.check | 3 +- 32 files changed, 160 insertions(+), 181 deletions(-) delete mode 100644 tests/neg/18493.check rename tests/{warn => neg}/i17613b/i17613b.scala (83%) rename tests/{warn => neg}/i17613b/importTry.scala (100%) rename tests/{neg => warn}/15981.check (66%) rename tests/{neg => warn}/17284.check (89%) create mode 100644 tests/warn/18493.check rename tests/{neg => warn}/i11022.check (76%) rename tests/{neg => warn}/i11333.check (70%) rename tests/{neg => warn}/i12253.check (71%) rename tests/{neg => warn}/i13440.check (71%) rename tests/{neg => warn}/i16649-refutable.check (81%) rename tests/{neg => warn}/i16728.check (59%) rename tests/{neg => warn}/i17266.check (86%) rename tests/{neg => warn}/i17612a.check (79%) rename tests/{neg => warn}/i17613a.check (77%) rename tests/{neg => warn}/i18722.check (91%) rename tests/{neg => warn}/i4008.check (86%) rename tests/{neg => warn}/i4812.check (67%) rename tests/{neg => warn}/i4986b.check (87%) rename tests/{neg => warn}/i6190b.check (70%) rename tests/{neg => warn}/i9266.check (76%) rename tests/{neg => warn}/i9408a.check (82%) rename tests/{neg => warn}/i9740.check (81%) rename tests/{neg => warn}/manifest-summoning-b.check (78%) rename tests/{neg => warn}/refutable-pattern-binding-messages.check (78%) rename tests/{neg => warn}/rewrite-messages.check (79%) rename tests/{neg/i15503-scala2 => warn}/scala2-t11681.scala (95%) rename tests/{neg => warn}/symbolic-packages.check (74%) rename tests/{neg => warn}/t3235-minimal.check (81%) rename tests/{neg => warn}/warn-value-discard.check (56%) rename tests/{neg => warn}/with-type-operator-future-migration.check (65%) diff --git a/tests/neg/18493.check b/tests/neg/18493.check deleted file mode 100644 index 2e78702c12e9..000000000000 --- a/tests/neg/18493.check +++ /dev/null @@ -1,9 +0,0 @@ --- [E030] Match case Unreachable Warning: tests/neg/18493.scala:6:9 ---------------------------------------------------- -6 | case "abc" => // warn - | ^^^^^ - | Unreachable case --- [E030] Match case Unreachable Warning: tests/neg/18493.scala:12:9 --------------------------------------------------- -12 | case "abc" => // warn - | ^^^^^ - | Unreachable case -No warnings can be incurred under -Werror. diff --git a/tests/neg/i17613b.check b/tests/neg/i17613b.check index d8cf8618fb27..15dd2f6451e6 100644 --- a/tests/neg/i17613b.check +++ b/tests/neg/i17613b.check @@ -1,56 +1,61 @@ --- Error: tests/neg/i17613b/i17613b.scala:9:13 ------------------------------------------------------------------------- -9 | def foobar[ImTrait](in: D) = in.toString // error - | ^^^^^^^ - | Type parameter ImTrait for method foobar shadows the type defined by trait ImTrait in object importTry --- Error: tests/neg/i17613b/i17613b.scala:10:13 ------------------------------------------------------------------------ -10 | type MySeq[ImTrait] = Seq[D] // error +-- Warning: tests/neg/i17613b/i17613b.scala:7:18 ----------------------------------------------------------------------- +7 | trait Typeclass[T] + | ^ + | Type parameter T for trait Typeclass shadows the type defined by type T in class B +-- Warning: tests/neg/i17613b/i17613b.scala:10:13 ---------------------------------------------------------------------- +10 | def foobar[ImTrait](in: D) = in.toString // warn + | ^^^^^^^ + | Type parameter ImTrait for method foobar shadows the type defined by trait ImTrait in object importTry +-- Warning: tests/neg/i17613b/i17613b.scala:11:13 ---------------------------------------------------------------------- +11 | type MySeq[ImTrait] = Seq[D] // warn | ^^^^^^^ | Type parameter ImTrait for type MySeq shadows the type defined by trait ImTrait in object importTry --- Error: tests/neg/i17613b/i17613b.scala:12:14 ------------------------------------------------------------------------ -12 | def foobar2[ImClass](in: D) = in.toString // error +-- Warning: tests/neg/i17613b/i17613b.scala:13:14 ---------------------------------------------------------------------- +13 | def foobar2[ImClass](in: D) = in.toString // warn | ^^^^^^^ | Type parameter ImClass for method foobar2 shadows the type defined by class ImClass in object importTry --- Error: tests/neg/i17613b/i17613b.scala:13:14 ------------------------------------------------------------------------ -13 | type MySeq2[ImClass] = Seq[D] // error +-- Warning: tests/neg/i17613b/i17613b.scala:14:14 ---------------------------------------------------------------------- +14 | type MySeq2[ImClass] = Seq[D] // warn | ^^^^^^^ | Type parameter ImClass for type MySeq2 shadows the type defined by class ImClass in object importTry --- Error: tests/neg/i17613b/i17613b.scala:16:24 ------------------------------------------------------------------------ -16 | type TypeLambda[A] = [ImTrait] =>> Map[ImTrait, B] // error +-- Warning: tests/neg/i17613b/i17613b.scala:17:24 ---------------------------------------------------------------------- +17 | type TypeLambda[A] = [ImTrait] =>> Map[ImTrait, B] | ^^^^^^^ | Type parameter ImTrait for type TypeLambda shadows the type defined by trait ImTrait in object importTry --- Error: tests/neg/i17613b/i17613b.scala:17:21 ------------------------------------------------------------------------ -17 | type PolyFun[A] = [ImTrait] => ImTrait => B // error +-- Warning: tests/neg/i17613b/i17613b.scala:18:21 ---------------------------------------------------------------------- +18 | type PolyFun[A] = [ImTrait] => ImTrait => B // warn | ^^^^^^^ | Type parameter ImTrait for type PolyFun shadows the type defined by trait ImTrait in object importTry --- Error: tests/neg/i17613b/i17613b.scala:23:12 ------------------------------------------------------------------------ -23 | class Foo[T](t: T): // error class parameter shadows some other type +-- Warning: tests/neg/i17613b/i17613b.scala:24:12 ---------------------------------------------------------------------- +24 | class Foo[T](t: T): // warn class parameter shadows some other type | ^ | Type parameter T for class Foo shadows the type defined by type T in class B --- Error: tests/neg/i17613b/i17613b.scala:27:15 ------------------------------------------------------------------------ -27 | def intType[List1](x: T) = x.toString() // error +-- Warning: tests/neg/i17613b/i17613b.scala:28:15 ---------------------------------------------------------------------- +28 | def intType[List1](x: T) = x.toString() // warn | ^^^^^ | Type parameter List1 for method intType shadows an explicitly renamed type : List1 --- Error: tests/neg/i17613b/i17613b.scala:32:10 ------------------------------------------------------------------------ -32 | given [Int]: Ordering[Int]() // error +-- Warning: tests/neg/i17613b/i17613b.scala:33:10 ---------------------------------------------------------------------- +33 | given [Int]: Typeclass[Int]() // warn | ^^^ - | Type parameter Int for method given_Ordering_Int shadows the type defined by class Int in package scala --- Error: tests/neg/i17613b/i17613b.scala:34:12 ------------------------------------------------------------------------ -34 | class C[M[List[_]]] // error List not renamed here + | Type parameter Int for method given_Typeclass_Int shadows the type defined by class Int in package scala +-- Warning: tests/neg/i17613b/i17613b.scala:35:12 ---------------------------------------------------------------------- +35 | class C[M[List[_]]] // warn List not renamed here | ^^^^^^^ | Type parameter List for class C shadows the type defined by type List in package scala --- Error: tests/neg/i17613b/i17613b.scala:35:11 ------------------------------------------------------------------------ -35 | type E[M[Int[_]]] = Int // error +-- Warning: tests/neg/i17613b/i17613b.scala:36:11 ---------------------------------------------------------------------- +36 | type E[M[Int[_]]] = Int // warn | ^^^^^^ | Type parameter Int for type E shadows the type defined by class Int in package scala --- Error: tests/neg/i17613b/i17613b.scala:37:14 ------------------------------------------------------------------------ -37 | def foo[N[M[List[_]]]] = // error +-- Warning: tests/neg/i17613b/i17613b.scala:38:14 ---------------------------------------------------------------------- +38 | def foo[N[M[List[_]]]] = // warn | ^^^^^^^ | Type parameter List for method foo shadows the type defined by type List in package scala --- Error: tests/neg/i17613b/i17613b.scala:40:11 ------------------------------------------------------------------------ -40 | type Z[ImClassR] = Int // error +-- Warning: tests/neg/i17613b/i17613b.scala:41:11 ---------------------------------------------------------------------- +41 | type Z[ImClassR] = Int // warn | ^^^^^^^^ | Type parameter ImClassR for type Z shadows an explicitly renamed type : ImClassR --- Error: tests/neg/i17613b/i17613b.scala:41:18 ------------------------------------------------------------------------ -41 | class InnerCl[ImClassR] // error +-- Warning: tests/neg/i17613b/i17613b.scala:42:18 ---------------------------------------------------------------------- +42 | class InnerCl[ImClassR] // warn | ^^^^^^^^ | Type parameter ImClassR for class InnerCl shadows an explicitly renamed type : ImClassR +No warnings can be incurred under -Werror. diff --git a/tests/warn/i17613b/i17613b.scala b/tests/neg/i17613b/i17613b.scala similarity index 83% rename from tests/warn/i17613b/i17613b.scala rename to tests/neg/i17613b/i17613b.scala index bf057f92837b..42506a274a65 100644 --- a/tests/warn/i17613b/i17613b.scala +++ b/tests/neg/i17613b/i17613b.scala @@ -1,9 +1,10 @@ -//> using options -Xlint:type-parameter-shadow +//> using options -Xlint:type-parameter-shadow -Xfatal-warnings object i17613b: import importTry._ class B: type T = Int + trait Typeclass[T] trait D def foobar[ImTrait](in: D) = in.toString // warn @@ -12,7 +13,7 @@ object i17613b: def foobar2[ImClass](in: D) = in.toString // warn type MySeq2[ImClass] = Seq[D] // warn - given [A]: Ordering[Int]() + given [A]: Typeclass[Int]() // warn type TypeLambda[A] = [ImTrait] =>> Map[ImTrait, B] type PolyFun[A] = [ImTrait] => ImTrait => B // warn type MatchType[A] = A match { @@ -28,8 +29,8 @@ object i17613b: type Y[List] = Int // no warning - given [A]: Ordering[A]() - given [Int]: Ordering[Int]() // warn + given [A]: Typeclass[A]() + given [Int]: Typeclass[Int]() // warn class C[M[List[_]]] // warn List not renamed here type E[M[Int[_]]] = Int // warn @@ -42,3 +43,5 @@ object i17613b: 5 def main(args: Array[String]) = println("Test for type parameter shadow") + + // nopos-error fatal warnings diff --git a/tests/warn/i17613b/importTry.scala b/tests/neg/i17613b/importTry.scala similarity index 100% rename from tests/warn/i17613b/importTry.scala rename to tests/neg/i17613b/importTry.scala diff --git a/tests/neg/15981.check b/tests/warn/15981.check similarity index 66% rename from tests/neg/15981.check rename to tests/warn/15981.check index d1cac67d2024..6cc57d86385f 100644 --- a/tests/neg/15981.check +++ b/tests/warn/15981.check @@ -1,7 +1,6 @@ --- [E092] Pattern Match Unchecked Warning: tests/neg/15981.scala:4:45 -------------------------------------------------- +-- [E092] Pattern Match Unchecked Warning: tests/warn/15981.scala:4:45 ------------------------------------------------- 4 | override def equals(any: Any): Boolean = any.isInstanceOf[PosInt] // warn | ^^^ | the type test for PosInt cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` -No warnings can be incurred under -Werror. diff --git a/tests/neg/17284.check b/tests/warn/17284.check similarity index 89% rename from tests/neg/17284.check rename to tests/warn/17284.check index 775f3e50b5f9..47df2d21e3a7 100644 --- a/tests/neg/17284.check +++ b/tests/warn/17284.check @@ -1,4 +1,4 @@ --- [E187] Potential Issue Warning: tests/neg/17284.scala:4:6 ----------------------------------------------------------- +-- [E187] Potential Issue Warning: tests/warn/17284.scala:4:6 ---------------------------------------------------------- 4 | 451.synchronized {} // warn | ^^^^^^^^^^^^^^^^ | Suspicious synchronized call on boxed class @@ -8,7 +8,7 @@ | You called the synchronized method on a boxed primitive. This might not be what | you intended. --------------------------------------------------------------------------------------------------------------------- --- [E187] Potential Issue Warning: tests/neg/17284.scala:8:4 ----------------------------------------------------------- +-- [E187] Potential Issue Warning: tests/warn/17284.scala:8:4 ---------------------------------------------------------- 8 | x.synchronized {} // warn | ^^^^^^^^^^^^^^ | Suspicious synchronized call on boxed class @@ -18,7 +18,7 @@ | You called the synchronized method on a boxed primitive. This might not be what | you intended. --------------------------------------------------------------------------------------------------------------------- --- [E187] Potential Issue Warning: tests/neg/17284.scala:11:7 ---------------------------------------------------------- +-- [E187] Potential Issue Warning: tests/warn/17284.scala:11:7 --------------------------------------------------------- 11 | true.synchronized {} // warn | ^^^^^^^^^^^^^^^^^ | Suspicious synchronized call on boxed class @@ -28,4 +28,3 @@ | You called the synchronized method on a boxed primitive. This might not be what | you intended. -------------------------------------------------------------------------------------------------------------------- -No warnings can be incurred under -Werror. diff --git a/tests/warn/18493.check b/tests/warn/18493.check new file mode 100644 index 000000000000..64f2e2aac735 --- /dev/null +++ b/tests/warn/18493.check @@ -0,0 +1,8 @@ +-- [E030] Match case Unreachable Warning: tests/warn/18493.scala:6:9 --------------------------------------------------- +6 | case "abc" => // warn + | ^^^^^ + | Unreachable case +-- [E030] Match case Unreachable Warning: tests/warn/18493.scala:12:9 -------------------------------------------------- +12 | case "abc" => // warn + | ^^^^^ + | Unreachable case diff --git a/tests/neg/i11022.check b/tests/warn/i11022.check similarity index 76% rename from tests/neg/i11022.check rename to tests/warn/i11022.check index 65e3083d95e4..4257bb64652c 100644 --- a/tests/neg/i11022.check +++ b/tests/warn/i11022.check @@ -1,21 +1,20 @@ --- Deprecation Warning: tests/neg/i11022.scala:10:7 -------------------------------------------------------------------- +-- Deprecation Warning: tests/warn/i11022.scala:10:7 ------------------------------------------------------------------- 10 |val a: CaseClass = CaseClass(42) // warn: deprecated type // warn: deprecated apply method | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass --- Deprecation Warning: tests/neg/i11022.scala:10:19 ------------------------------------------------------------------- +-- Deprecation Warning: tests/warn/i11022.scala:10:19 ------------------------------------------------------------------ 10 |val a: CaseClass = CaseClass(42) // warn: deprecated type // warn: deprecated apply method | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass --- Deprecation Warning: tests/neg/i11022.scala:11:7 -------------------------------------------------------------------- +-- Deprecation Warning: tests/warn/i11022.scala:11:7 ------------------------------------------------------------------- 11 |val b: CaseClass = new CaseClass(42) // warn: deprecated type // warn: deprecated class | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass --- Deprecation Warning: tests/neg/i11022.scala:11:23 ------------------------------------------------------------------- +-- Deprecation Warning: tests/warn/i11022.scala:11:23 ------------------------------------------------------------------ 11 |val b: CaseClass = new CaseClass(42) // warn: deprecated type // warn: deprecated class | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass --- Deprecation Warning: tests/neg/i11022.scala:12:14 ------------------------------------------------------------------- +-- Deprecation Warning: tests/warn/i11022.scala:12:14 ------------------------------------------------------------------ 12 |val c: Unit = CaseClass(42).magic() // warn: deprecated apply method | ^^^^^^^^^ | class CaseClass is deprecated: no CaseClass -No warnings can be incurred under -Werror. diff --git a/tests/neg/i11333.check b/tests/warn/i11333.check similarity index 70% rename from tests/neg/i11333.check rename to tests/warn/i11333.check index 05f6de27062c..df22502cc649 100644 --- a/tests/neg/i11333.check +++ b/tests/warn/i11333.check @@ -1,31 +1,30 @@ --- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:4:19 -------------------------------------------------------- +-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:4:19 ------------------------------------------------------- 4 | val f1: Float = 123456789 // warn | ^^^^^^^^^ | Widening conversion from Int to Float loses precision. | Write `.toFloat` instead. --- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:5:19 -------------------------------------------------------- +-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:5:19 ------------------------------------------------------- 5 | val d1: Double = 1234567890123456789L // warn | ^^^^^^^^^^^^^^^^^^^^ | Widening conversion from Long to Double loses precision. | Write `.toDouble` instead. --- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:6:19 -------------------------------------------------------- +-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:6:19 ------------------------------------------------------- 6 | val f2: Float = 123456789L // warn | ^^^^^^^^^^ | Widening conversion from Long to Float loses precision. | Write `.toFloat` instead. --- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:12:21 ------------------------------------------------------- +-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:12:21 ------------------------------------------------------ 12 | val f1_b: Float = i1 // warn | ^^ | Widening conversion from Int to Float loses precision. | Write `.toFloat` instead. --- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:13:21 ------------------------------------------------------- +-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:13:21 ------------------------------------------------------ 13 | val d1_b: Double = l1 // warn | ^^ | Widening conversion from Long to Double loses precision. | Write `.toDouble` instead. --- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:14:21 ------------------------------------------------------- +-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:14:21 ------------------------------------------------------ 14 | val f2_b: Float = l2 // warn | ^^ | Widening conversion from Long to Float loses precision. | Write `.toFloat` instead. -No warnings can be incurred under -Werror. diff --git a/tests/neg/i12253.check b/tests/warn/i12253.check similarity index 71% rename from tests/neg/i12253.check rename to tests/warn/i12253.check index e0a5886ad676..e33a6214a438 100644 --- a/tests/neg/i12253.check +++ b/tests/warn/i12253.check @@ -1,14 +1,13 @@ --- [E092] Pattern Match Unchecked Warning: tests/neg/i12253.scala:13:10 ------------------------------------------------ +-- [E092] Pattern Match Unchecked Warning: tests/warn/i12253.scala:13:10 ----------------------------------------------- 13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // warn // warn | ^ |the type test for extractors.q2.reflect.Term cannot be checked at runtime because it refers to an abstract type member or type parameter | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Unchecked Warning: tests/neg/i12253.scala:13:38 ------------------------------------------------ +-- [E092] Pattern Match Unchecked Warning: tests/warn/i12253.scala:13:38 ----------------------------------------------- 13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // warn // warn | ^ |the type test for q1.reflect.Select cannot be checked at runtime because it refers to an abstract type member or type parameter | | longer explanation available when compiling with `-explain` -No warnings can be incurred under -Werror. there was 1 deprecation warning; re-run with -deprecation for details diff --git a/tests/neg/i13440.check b/tests/warn/i13440.check similarity index 71% rename from tests/neg/i13440.check rename to tests/warn/i13440.check index b173835cc3bb..a27e5635fed3 100644 --- a/tests/neg/i13440.check +++ b/tests/warn/i13440.check @@ -1,13 +1,12 @@ --- Migration Warning: tests/neg/i13440.scala:5:4 ----------------------------------------------------------------------- +-- Migration Warning: tests/warn/i13440.scala:5:4 ---------------------------------------------------------------------- 5 |def given = 42 // warn | ^ | given is now a keyword, write `given` instead of given to keep it as an identifier --- Migration Warning: tests/neg/i13440.scala:7:13 ---------------------------------------------------------------------- +-- Migration Warning: tests/warn/i13440.scala:7:13 --------------------------------------------------------------------- 7 |case class C(enum: List[Int] = Nil) { // warn | ^ | enum is now a keyword, write `enum` instead of enum to keep it as an identifier --- Migration Warning: tests/neg/i13440.scala:8:11 ---------------------------------------------------------------------- +-- Migration Warning: tests/warn/i13440.scala:8:11 --------------------------------------------------------------------- 8 | val s = s"$enum" // warn | ^ | enum is now a keyword, write `enum` instead of enum to keep it as an identifier -No warnings can be incurred under -Werror. diff --git a/tests/neg/i16649-refutable.check b/tests/warn/i16649-refutable.check similarity index 81% rename from tests/neg/i16649-refutable.check rename to tests/warn/i16649-refutable.check index b3e4e06624f2..a6cacfc691ee 100644 --- a/tests/neg/i16649-refutable.check +++ b/tests/warn/i16649-refutable.check @@ -1,4 +1,4 @@ --- Warning: tests/neg/i16649-refutable.scala:6:6 ----------------------------------------------------------------------- +-- Warning: tests/warn/i16649-refutable.scala:6:6 ---------------------------------------------------------------------- 6 | val '{ ($y: Int) + ($z: Int) } = x // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | pattern binding uses refutable extractor `'{...}` @@ -6,4 +6,3 @@ | 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. -No warnings can be incurred under -Werror. diff --git a/tests/neg/i16728.check b/tests/warn/i16728.check similarity index 59% rename from tests/neg/i16728.check rename to tests/warn/i16728.check index 64f4f5c9de76..117b2bd0c4d4 100644 --- a/tests/neg/i16728.check +++ b/tests/warn/i16728.check @@ -1,7 +1,6 @@ --- [E092] Pattern Match Unchecked Warning: tests/neg/i16728.scala:18:11 ------------------------------------------------ +-- [E092] Pattern Match Unchecked Warning: tests/warn/i16728.scala:18:11 ----------------------------------------------- 18 | case tx : C[Int]#X => // warn | ^ | the type test for C[Int] cannot be checked at runtime because its type arguments can't be determined from A | | longer explanation available when compiling with `-explain` -No warnings can be incurred under -Werror. diff --git a/tests/neg/i17266.check b/tests/warn/i17266.check similarity index 86% rename from tests/neg/i17266.check rename to tests/warn/i17266.check index 1cb89784ddcc..716cd531dd0a 100644 --- a/tests/neg/i17266.check +++ b/tests/warn/i17266.check @@ -1,4 +1,4 @@ --- [E181] Potential Issue Warning: tests/neg/i17266.scala:4:2 ---------------------------------------------------------- +-- [E181] Potential Issue Warning: tests/warn/i17266.scala:4:2 --------------------------------------------------------- 4 | synchronized { // warn | ^^^^^^^^^^^^ | Suspicious top-level unqualified call to synchronized @@ -9,7 +9,7 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. --------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Warning: tests/neg/i17266.scala:17:2 --------------------------------------------------------- +-- [E181] Potential Issue Warning: tests/warn/i17266.scala:17:2 -------------------------------------------------------- 17 | synchronized { // warn | ^^^^^^^^^^^^ | Suspicious top-level unqualified call to synchronized @@ -20,7 +20,7 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. -------------------------------------------------------------------------------------------------------------------- --- [E187] Potential Issue Warning: tests/neg/i17266.scala:22:4 --------------------------------------------------------- +-- [E187] Potential Issue Warning: tests/warn/i17266.scala:22:4 -------------------------------------------------------- 22 | 1.synchronized { // warn | ^^^^^^^^^^^^^^ | Suspicious synchronized call on boxed class @@ -30,7 +30,7 @@ | You called the synchronized method on a boxed primitive. This might not be what | you intended. -------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Warning: tests/neg/i17266.scala:108:2 -------------------------------------------------------- +-- [E181] Potential Issue Warning: tests/warn/i17266.scala:108:2 ------------------------------------------------------- 108 | wait() // warn | ^^^^ | Suspicious top-level unqualified call to wait @@ -41,7 +41,7 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Warning: tests/neg/i17266.scala:115:2 -------------------------------------------------------- +-- [E181] Potential Issue Warning: tests/warn/i17266.scala:115:2 ------------------------------------------------------- 115 | wait() // warn | ^^^^ | Suspicious top-level unqualified call to wait @@ -52,7 +52,7 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Warning: tests/neg/i17266.scala:121:2 -------------------------------------------------------- +-- [E181] Potential Issue Warning: tests/warn/i17266.scala:121:2 ------------------------------------------------------- 121 | wait(10) // warn | ^^^^ | Suspicious top-level unqualified call to wait @@ -63,7 +63,7 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Warning: tests/neg/i17266.scala:128:2 -------------------------------------------------------- +-- [E181] Potential Issue Warning: tests/warn/i17266.scala:128:2 ------------------------------------------------------- 128 | wait(10) // warn | ^^^^ | Suspicious top-level unqualified call to wait @@ -74,7 +74,7 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Warning: tests/neg/i17266.scala:134:2 -------------------------------------------------------- +-- [E181] Potential Issue Warning: tests/warn/i17266.scala:134:2 ------------------------------------------------------- 134 | hashCode() // warn | ^^^^^^^^ | Suspicious top-level unqualified call to hashCode @@ -85,7 +85,7 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- --- [E181] Potential Issue Warning: tests/neg/i17266.scala:141:2 -------------------------------------------------------- +-- [E181] Potential Issue Warning: tests/warn/i17266.scala:141:2 ------------------------------------------------------- 141 | hashCode() // warn | ^^^^^^^^ | Suspicious top-level unqualified call to hashCode @@ -96,4 +96,3 @@ | resolved to calls on Predef or on imported methods. This might not be what | you intended. ------------------------------------------------------------------------------------------------------------------- -No warnings can be incurred under -Werror. diff --git a/tests/neg/i17612a.check b/tests/warn/i17612a.check similarity index 79% rename from tests/neg/i17612a.check rename to tests/warn/i17612a.check index 48e5b9c17be9..67b489f17a91 100644 --- a/tests/neg/i17612a.check +++ b/tests/warn/i17612a.check @@ -1,33 +1,32 @@ --- Warning: tests/neg/i17612a.scala:18:15 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17612a.scala:18:15 ----------------------------------------------------------------------------- 18 | class Derived(x : Int, y: Int, z2: Int) extends Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y | ^ | value x in class Derived shadows field x inherited from class Base --- Warning: tests/neg/i17612a.scala:18:24 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17612a.scala:18:24 ----------------------------------------------------------------------------- 18 | class Derived(x : Int, y: Int, z2: Int) extends Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y | ^ | value y in class Derived shadows field y inherited from class Base --- Warning: tests/neg/i17612a.scala:20:2 ------------------------------------------------------------------------------- +-- Warning: tests/warn/i17612a.scala:20:2 ------------------------------------------------------------------------------ 20 | private val shadowed2 = 2 + 2 // warn (In Scala 2 we cannot do that got the warning) | ^ | value shadowed2 in class Derived shadows field shadowed2 inherited from class Base --- Warning: tests/neg/i17612a.scala:21:2 ------------------------------------------------------------------------------- +-- Warning: tests/warn/i17612a.scala:21:2 ------------------------------------------------------------------------------ 21 | private[this] val shadowed3 = 3 + 3 // warn | ^ | value shadowed3 in class Derived shadows field shadowed3 inherited from class Base --- Warning: tests/neg/i17612a.scala:23:2 ------------------------------------------------------------------------------- +-- Warning: tests/warn/i17612a.scala:23:2 ------------------------------------------------------------------------------ 23 | private val shadowed5 = 5 + 5 // warn | ^ | value shadowed5 in class Derived shadows field shadowed5 inherited from class Base --- Warning: tests/neg/i17612a.scala:34:20 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17612a.scala:34:20 ----------------------------------------------------------------------------- 34 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // warn // warn // warn | ^ | value x in class UnderDerived shadows field x inherited from class Base --- Warning: tests/neg/i17612a.scala:34:28 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17612a.scala:34:28 ----------------------------------------------------------------------------- 34 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // warn // warn // warn | ^ | value y in class UnderDerived shadows field y inherited from class Base --- Warning: tests/neg/i17612a.scala:34:36 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17612a.scala:34:36 ----------------------------------------------------------------------------- 34 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, y, z) // warn // warn // warn | ^ | value z in class UnderDerived shadows field z inherited from class Base -No warnings can be incurred under -Werror. diff --git a/tests/neg/i17613a.check b/tests/warn/i17613a.check similarity index 77% rename from tests/neg/i17613a.check rename to tests/warn/i17613a.check index eccafae81427..6e40d102b1a4 100644 --- a/tests/neg/i17613a.check +++ b/tests/warn/i17613a.check @@ -1,29 +1,28 @@ --- Warning: tests/neg/i17613a.scala:8:13 ------------------------------------------------------------------------------- +-- Warning: tests/warn/i17613a.scala:8:13 ------------------------------------------------------------------------------ 8 | def foobar[D](in: D) = in.toString // warn method parameter shadows some other type | ^ | Type parameter D for method foobar shadows the type defined by trait D in class B --- Warning: tests/neg/i17613a.scala:9:13 ------------------------------------------------------------------------------- +-- Warning: tests/warn/i17613a.scala:9:13 ------------------------------------------------------------------------------ 9 | type MySeq[D] = Seq[D] // warn type member's parameter shadows some other type | ^ | Type parameter D for type MySeq shadows the type defined by trait D in class B --- Warning: tests/neg/i17613a.scala:11:12 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17613a.scala:11:12 ----------------------------------------------------------------------------- 11 | class Foo[T](t: T): // warn class parameter shadows some other type | ^ | Type parameter T for class Foo shadows the type defined by type T in class B --- Warning: tests/neg/i17613a.scala:12:11 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17613a.scala:12:11 ----------------------------------------------------------------------------- 12 | def bar[T](w: T) = w.toString // warn a type parameter shadows another type parameter | ^ | Type parameter T for method bar shadows the type defined by type T in class Foo --- Warning: tests/neg/i17613a.scala:15:12 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17613a.scala:15:12 ----------------------------------------------------------------------------- 15 | class C[M[List[_]]] // warn | ^^^^^^^ | Type parameter List for class C shadows the type defined by type List in package scala --- Warning: tests/neg/i17613a.scala:16:11 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17613a.scala:16:11 ----------------------------------------------------------------------------- 16 | type E[M[List[_]]] = Int // warn | ^^^^^^^ | Type parameter List for type E shadows the type defined by type List in package scala --- Warning: tests/neg/i17613a.scala:17:14 ------------------------------------------------------------------------------ +-- Warning: tests/warn/i17613a.scala:17:14 ----------------------------------------------------------------------------- 17 | def foo[N[M[List[_]]]] = ??? // warn | ^^^^^^^ | Type parameter List for method foo shadows the type defined by type List in package scala -No warnings can be incurred under -Werror. diff --git a/tests/neg/i18722.check b/tests/warn/i18722.check similarity index 91% rename from tests/neg/i18722.check rename to tests/warn/i18722.check index d6ebf3d6b474..4fae07e15204 100644 --- a/tests/neg/i18722.check +++ b/tests/warn/i18722.check @@ -1,4 +1,4 @@ --- [E190] Potential Issue Warning: tests/neg/i18722.scala:3:15 --------------------------------------------------------- +-- [E190] Potential Issue Warning: tests/warn/i18722.scala:3:15 -------------------------------------------------------- 3 |def f1: Unit = null // warn | ^^^^ | Discarded non-Unit value of type Null. You may want to use `()`. @@ -9,7 +9,7 @@ | Here the `null` expression is a pure statement that can be discarded. | Therefore the expression is effectively equivalent to `()`. --------------------------------------------------------------------------------------------------------------------- --- [E190] Potential Issue Warning: tests/neg/i18722.scala:4:15 --------------------------------------------------------- +-- [E190] Potential Issue Warning: tests/warn/i18722.scala:4:15 -------------------------------------------------------- 4 |def f2: Unit = 1 // warn | ^ | Discarded non-Unit value of type Int. You may want to use `()`. @@ -20,7 +20,7 @@ | Here the `1` expression is a pure statement that can be discarded. | Therefore the expression is effectively equivalent to `()`. --------------------------------------------------------------------------------------------------------------------- --- [E190] Potential Issue Warning: tests/neg/i18722.scala:5:15 --------------------------------------------------------- +-- [E190] Potential Issue Warning: tests/warn/i18722.scala:5:15 -------------------------------------------------------- 5 |def f3: Unit = "a" // warn | ^^^ | Discarded non-Unit value of type String. You may want to use `()`. @@ -31,7 +31,7 @@ | Here the `"a"` expression is a pure statement that can be discarded. | Therefore the expression is effectively equivalent to `()`. --------------------------------------------------------------------------------------------------------------------- --- [E190] Potential Issue Warning: tests/neg/i18722.scala:7:15 --------------------------------------------------------- +-- [E190] Potential Issue Warning: tests/warn/i18722.scala:7:15 -------------------------------------------------------- 7 |def f4: Unit = i // warn | ^ | Discarded non-Unit value of type Int. You may want to use `()`. @@ -42,4 +42,3 @@ | Here the `i` expression is a pure statement that can be discarded. | Therefore the expression is effectively equivalent to `()`. --------------------------------------------------------------------------------------------------------------------- -No warnings can be incurred under -Werror. diff --git a/tests/neg/i4008.check b/tests/warn/i4008.check similarity index 86% rename from tests/neg/i4008.check rename to tests/warn/i4008.check index accc8b0d29b2..b72e7a8c20c5 100644 --- a/tests/neg/i4008.check +++ b/tests/warn/i4008.check @@ -1,41 +1,40 @@ --- [E158] Reference Warning: tests/neg/i4008.scala:7:56 ---------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4008.scala:7:56 --------------------------------------------------------------- 7 |@annotation.implicitNotFound("An implicit ShouldWarn1[${B}] is not in scope") // warn | ^ | Invalid reference to a type variable `B` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn1`. --- [E158] Reference Warning: tests/neg/i4008.scala:11:56 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4008.scala:11:56 -------------------------------------------------------------- 11 |@annotation.implicitNotFound("An implicit ShouldWarn2[${A}] is not in scope") // warn | ^ | Invalid reference to a type variable `A` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn2`. --- [E158] Reference Warning: tests/neg/i4008.scala:15:56 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4008.scala:15:56 -------------------------------------------------------------- 15 |@annotation.implicitNotFound("An implicit ShouldWarn3[${A},${B}] is not in scope") // warn | ^ | Invalid reference to a type variable `A` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn3`. --- [E158] Reference Warning: tests/neg/i4008.scala:19:56 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4008.scala:19:56 -------------------------------------------------------------- 19 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // warn // warn | ^ | Invalid reference to a type variable `A` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn4`. --- [E158] Reference Warning: tests/neg/i4008.scala:19:61 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4008.scala:19:61 -------------------------------------------------------------- 19 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // warn // warn | ^ | Invalid reference to a type variable `B` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn4`. --- [E158] Reference Warning: tests/neg/i4008.scala:23:61 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4008.scala:23:61 -------------------------------------------------------------- 23 |@annotation.implicitNotFound("An implicit ShouldWarn5[${C},${Abc}] is not in scope") // warn | ^ | Invalid reference to a type variable `Abc` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `ShouldWarn5`. --- [E158] Reference Warning: tests/neg/i4008.scala:46:54 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4008.scala:46:54 -------------------------------------------------------------- 46 |class C[A](using @annotation.implicitNotFound("No C[${B}] found") c: Class[A]) // warn | ^ | Invalid reference to a type variable `B` found in the annotation argument. | The variable does not occur as a parameter in the scope of the constructor of `C`. --- [E158] Reference Warning: tests/neg/i4008.scala:48:62 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4008.scala:48:62 -------------------------------------------------------------- 48 |def someMethod1[A](using @annotation.implicitNotFound("No C[${B}] found") sc: C[A]) = 0 // warn | ^ | Invalid reference to a type variable `B` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `someMethod1`. -No warnings can be incurred under -Werror. diff --git a/tests/neg/i4812.check b/tests/warn/i4812.check similarity index 67% rename from tests/neg/i4812.check rename to tests/warn/i4812.check index fccaa62f0c80..a09e91b4c797 100644 --- a/tests/neg/i4812.check +++ b/tests/warn/i4812.check @@ -1,43 +1,42 @@ --- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:8:11 -------------------------------------------------- +-- [E092] Pattern Match Unchecked Warning: tests/warn/i4812.scala:8:11 ------------------------------------------------- 8 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:18:11 ------------------------------------------------- +-- [E092] Pattern Match Unchecked Warning: tests/warn/i4812.scala:18:11 ------------------------------------------------ 18 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:28:11 ------------------------------------------------- +-- [E092] Pattern Match Unchecked Warning: tests/warn/i4812.scala:28:11 ------------------------------------------------ 28 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:38:11 ------------------------------------------------- +-- [E092] Pattern Match Unchecked Warning: tests/warn/i4812.scala:38:11 ------------------------------------------------ 38 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:50:13 ------------------------------------------------- +-- [E092] Pattern Match Unchecked Warning: tests/warn/i4812.scala:50:13 ------------------------------------------------ 50 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:60:11 ------------------------------------------------- +-- [E092] Pattern Match Unchecked Warning: tests/warn/i4812.scala:60:11 ------------------------------------------------ 60 | case prev: A => // warn: the type test for A cannot be checked at runtime | ^ | the type test for A cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` --- [E092] Pattern Match Unchecked Warning: tests/neg/i4812.scala:96:11 ------------------------------------------------- +-- [E092] Pattern Match Unchecked Warning: tests/warn/i4812.scala:96:11 ------------------------------------------------ 96 | case x: B => // warn: the type test for B cannot be checked at runtime | ^ | the type test for B cannot be checked at runtime because it's a local class | | longer explanation available when compiling with `-explain` -No warnings can be incurred under -Werror. diff --git a/tests/neg/i4986b.check b/tests/warn/i4986b.check similarity index 87% rename from tests/neg/i4986b.check rename to tests/warn/i4986b.check index 60a5163ba756..f20b467a295d 100644 --- a/tests/neg/i4986b.check +++ b/tests/warn/i4986b.check @@ -1,41 +1,40 @@ --- [E158] Reference Warning: tests/neg/i4986b.scala:5:65 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4986b.scala:5:65 -------------------------------------------------------------- 5 |@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.") // warn // warn | ^ | Invalid reference to a type variable `Too` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `Meh`. --- [E158] Reference Warning: tests/neg/i4986b.scala:5:94 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4986b.scala:5:94 -------------------------------------------------------------- 5 |@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.") // warn // warn | ^ | Invalid reference to a type variable `Elem` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `Meh`. --- [E158] Reference Warning: tests/neg/i4986b.scala:8:71 --------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4986b.scala:8:71 -------------------------------------------------------------- 8 |@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.") // warn | ^ | Invalid reference to a type variable `Elem` found in the annotation argument. | The variable does not occur as a parameter in the scope of type `Meh2`. --- [E158] Reference Warning: tests/neg/i4986b.scala:11:46 -------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4986b.scala:11:46 ------------------------------------------------------------- 11 |class C[T](implicit @implicitNotFound("No C[${t}] available") t: T) // warn | ^ | Invalid reference to a type variable `t` found in the annotation argument. | The variable does not occur as a parameter in the scope of the constructor of `C`. --- [E158] Reference Warning: tests/neg/i4986b.scala:14:54 -------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4986b.scala:14:54 ------------------------------------------------------------- 14 | def m[Aaa](implicit @implicitNotFound("I see no C[${Uuh}]") theC: C[Aaa]) = ??? // warn | ^ | Invalid reference to a type variable `Uuh` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `m`. --- [E158] Reference Warning: tests/neg/i4986b.scala:20:73 -------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4986b.scala:20:73 ------------------------------------------------------------- 20 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // warn // warn // warn | ^ | Invalid reference to a type variable `XX` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `m`. --- [E158] Reference Warning: tests/neg/i4986b.scala:20:79 -------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4986b.scala:20:79 ------------------------------------------------------------- 20 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // warn // warn // warn | ^ | Invalid reference to a type variable `ZZ` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `m`. --- [E158] Reference Warning: tests/neg/i4986b.scala:20:86 -------------------------------------------------------------- +-- [E158] Reference Warning: tests/warn/i4986b.scala:20:86 ------------------------------------------------------------- 20 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // warn // warn // warn | ^ | Invalid reference to a type variable `Nix` found in the annotation argument. | The variable does not occur as a parameter in the scope of method `m`. -No warnings can be incurred under -Werror. diff --git a/tests/neg/i6190b.check b/tests/warn/i6190b.check similarity index 70% rename from tests/neg/i6190b.check rename to tests/warn/i6190b.check index 56f23d92f671..eecf7bbcf13e 100644 --- a/tests/neg/i6190b.check +++ b/tests/warn/i6190b.check @@ -1,5 +1,4 @@ --- Warning: tests/neg/i6190b.scala:5:29 -------------------------------------------------------------------------------- +-- Warning: tests/warn/i6190b.scala:5:29 ------------------------------------------------------------------------------- 5 |def foo = List("1", "2").map(Rule) // warn | ^^^^ | The method `apply` is inserted. The auto insertion will be deprecated, please write `Rule.apply` explicitly. -No warnings can be incurred under -Werror. diff --git a/tests/neg/i9266.check b/tests/warn/i9266.check similarity index 76% rename from tests/neg/i9266.check rename to tests/warn/i9266.check index d3c0ab354c16..90dfe43bd2b2 100644 --- a/tests/neg/i9266.check +++ b/tests/warn/i9266.check @@ -1,6 +1,5 @@ --- Migration Warning: tests/neg/i9266.scala:5:22 ----------------------------------------------------------------------- +-- Migration Warning: tests/warn/i9266.scala:5:22 ---------------------------------------------------------------------- 5 |def test = { implicit x: Int => x + x } // warn | ^ | This syntax is no longer supported; parameter needs to be enclosed in (...) | This construct can be rewritten automatically under -rewrite -source future-migration. -No warnings can be incurred under -Werror. diff --git a/tests/neg/i9408a.check b/tests/warn/i9408a.check similarity index 82% rename from tests/neg/i9408a.check rename to tests/warn/i9408a.check index 699128cdc5ce..ed2e94090cae 100644 --- a/tests/neg/i9408a.check +++ b/tests/warn/i9408a.check @@ -1,25 +1,24 @@ --- Migration Warning: tests/neg/i9408a.scala:18:20 --------------------------------------------------------------------- +-- Migration Warning: tests/warn/i9408a.scala:18:20 -------------------------------------------------------------------- 18 | val length: Int = "qwerty" // warn | ^^^^^^^^ |The conversion (Test3.implicitLength : String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Migration Warning: tests/neg/i9408a.scala:23:20 --------------------------------------------------------------------- +-- Migration Warning: tests/warn/i9408a.scala:23:20 -------------------------------------------------------------------- 23 | val length: Int = "qwerty" // warn | ^^^^^^^^ |The conversion (Test4.implicitLength : => String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Migration Warning: tests/neg/i9408a.scala:28:20 --------------------------------------------------------------------- +-- Migration Warning: tests/warn/i9408a.scala:28:20 -------------------------------------------------------------------- 28 | val length: Int = "qwerty" // warn | ^^^^^^^^ |The conversion (Test5.implicitLength : [A]: String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Migration Warning: tests/neg/i9408a.scala:33:20 --------------------------------------------------------------------- +-- Migration Warning: tests/warn/i9408a.scala:33:20 -------------------------------------------------------------------- 33 | val length: Int = "qwerty" // warn | ^^^^^^^^ |The conversion (Test6.implicitLength : Map[String, Int]) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Migration Warning: tests/neg/i9408a.scala:37:60 --------------------------------------------------------------------- +-- Migration Warning: tests/warn/i9408a.scala:37:60 -------------------------------------------------------------------- 37 | implicit def a2int[A](a: A)(implicit ev: A => Int): Int = a // warn | ^ |The conversion (ev : A => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. --- Migration Warning: tests/neg/i9408a.scala:61:2 ---------------------------------------------------------------------- +-- Migration Warning: tests/warn/i9408a.scala:61:2 --------------------------------------------------------------------- 61 | 123.foo // warn | ^^^ |The conversion (Test11.a2foo : [A]: A => Test11.Foo) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. -No warnings can be incurred under -Werror. diff --git a/tests/neg/i9740.check b/tests/warn/i9740.check similarity index 81% rename from tests/neg/i9740.check rename to tests/warn/i9740.check index 1d8280ca1963..7d41bab8ec50 100644 --- a/tests/neg/i9740.check +++ b/tests/warn/i9740.check @@ -1,13 +1,12 @@ --- [E186] Type Warning: tests/neg/i9740.scala:10:9 --------------------------------------------------------------------- +-- [E186] Type Warning: tests/warn/i9740.scala:10:9 -------------------------------------------------------------------- 10 | case RecoveryCompleted => println("Recovery completed") // warn | ^^^^^^^^^^^^^^^^^ | Implausible pattern: | RecoveryCompleted could match selector of type object TypedRecoveryCompleted | only if there is an `equals` method identifying elements of the two types. --- [E186] Type Warning: tests/neg/i9740.scala:15:9 --------------------------------------------------------------------- +-- [E186] Type Warning: tests/warn/i9740.scala:15:9 -------------------------------------------------------------------- 15 | case RecoveryCompleted => // warn | ^^^^^^^^^^^^^^^^^ | Implausible pattern: | RecoveryCompleted could match selector of type TypedRecoveryCompleted | only if there is an `equals` method identifying elements of the two types. -No warnings can be incurred under -Werror. diff --git a/tests/neg/manifest-summoning-b.check b/tests/warn/manifest-summoning-b.check similarity index 78% rename from tests/neg/manifest-summoning-b.check rename to tests/warn/manifest-summoning-b.check index c364ab4f4a9c..590b27ddbd98 100644 --- a/tests/neg/manifest-summoning-b.check +++ b/tests/warn/manifest-summoning-b.check @@ -1,15 +1,14 @@ --- Deprecation Warning: tests/neg/manifest-summoning-b.scala:3:34 ------------------------------------------------------ +-- Deprecation Warning: tests/warn/manifest-summoning-b.scala:3:34 ----------------------------------------------------- 3 |val foo = manifest[List[? <: Int]] // warn | ^ | Compiler synthesis of Manifest and OptManifest is deprecated, instead | replace with the type `scala.reflect.ClassTag[List[? <: Int]]`. | Alternatively, consider using the new metaprogramming features of Scala 3, | see https://docs.scala-lang.org/scala3/reference/metaprogramming.html --- Deprecation Warning: tests/neg/manifest-summoning-b.scala:4:41 ------------------------------------------------------ +-- Deprecation Warning: tests/warn/manifest-summoning-b.scala:4:41 ----------------------------------------------------- 4 |val bar = optManifest[Array[? <: String]] // warn | ^ | Compiler synthesis of Manifest and OptManifest is deprecated, instead | replace with the type `scala.reflect.ClassTag[Array[? <: String]]`. | Alternatively, consider using the new metaprogramming features of Scala 3, | see https://docs.scala-lang.org/scala3/reference/metaprogramming.html -No warnings can be incurred under -Werror. diff --git a/tests/neg/refutable-pattern-binding-messages.check b/tests/warn/refutable-pattern-binding-messages.check similarity index 78% rename from tests/neg/refutable-pattern-binding-messages.check rename to tests/warn/refutable-pattern-binding-messages.check index 50564f5675d2..bb0ead7929bf 100644 --- a/tests/neg/refutable-pattern-binding-messages.check +++ b/tests/warn/refutable-pattern-binding-messages.check @@ -1,4 +1,4 @@ --- Warning: tests/neg/refutable-pattern-binding-messages.scala:5:14 ---------------------------------------------------- +-- Warning: tests/warn/refutable-pattern-binding-messages.scala:5:14 --------------------------------------------------- 5 | val Positive(p) = 5 // warn: refutable extractor | ^^^^^^^^^^^^^^^ | pattern binding uses refutable extractor `Test.Positive` @@ -6,7 +6,7 @@ | 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. --- Warning: tests/neg/refutable-pattern-binding-messages.scala:6:14 ---------------------------------------------------- +-- Warning: tests/warn/refutable-pattern-binding-messages.scala:6:14 --------------------------------------------------- 6 | for Positive(i) <- List(1, 2, 3) do () // warn: refutable extractor | ^^^^^^^^^^^ | pattern binding uses refutable extractor `Test.Positive` @@ -14,7 +14,7 @@ | 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. --- Warning: tests/neg/refutable-pattern-binding-messages.scala:10:20 --------------------------------------------------- +-- Warning: tests/warn/refutable-pattern-binding-messages.scala:10:20 -------------------------------------------------- 10 | val i :: is = List(1, 2, 3) // warn: pattern type more specialized | ^^^^^^^^^^^^^ | pattern's type ::[Int] is more specialized than the right hand side expression's type List[Int] @@ -22,7 +22,7 @@ | 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/refutable-pattern-binding-messages.scala:11:11 --------------------------------------------------- +-- Warning: tests/warn/refutable-pattern-binding-messages.scala:11:11 -------------------------------------------------- 11 | for ((x: String) <- xs) do () // warn: pattern type more specialized | ^^^^^^ | pattern's type String is more specialized than the right hand side expression's type AnyRef @@ -30,7 +30,7 @@ | 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. --- Warning: tests/neg/refutable-pattern-binding-messages.scala:15:13 --------------------------------------------------- +-- Warning: tests/warn/refutable-pattern-binding-messages.scala:15:13 -------------------------------------------------- 15 | for none @ None <- ys do () // warn: pattern type does not match | ^^^^ | pattern's type None.type does not match the right hand side expression's type (x$1 : Option[?]) @@ -38,7 +38,7 @@ | 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. --- Warning: tests/neg/refutable-pattern-binding-messages.scala:16:10 --------------------------------------------------- +-- Warning: tests/warn/refutable-pattern-binding-messages.scala:16:10 -------------------------------------------------- 16 | val 1 = 2 // warn: pattern type does not match | ^ | pattern's type (1 : Int) does not match the right hand side expression's type (2 : Int) @@ -46,4 +46,3 @@ | 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. -No warnings can be incurred under -Werror. diff --git a/tests/neg/rewrite-messages.check b/tests/warn/rewrite-messages.check similarity index 79% rename from tests/neg/rewrite-messages.check rename to tests/warn/rewrite-messages.check index b1aa67845a3f..75469aad4145 100644 --- a/tests/neg/rewrite-messages.check +++ b/tests/warn/rewrite-messages.check @@ -1,12 +1,11 @@ --- Migration Warning: tests/neg/rewrite-messages.scala:3:18 ------------------------------------------------------------ +-- Migration Warning: tests/warn/rewrite-messages.scala:3:18 ----------------------------------------------------------- 3 |import scala.util._ // warn | ^ | `_` is no longer supported for a wildcard import; use `*` instead | This construct can be rewritten automatically under -rewrite -source future-migration. --- Deprecation Warning: tests/neg/rewrite-messages.scala:7:4 ----------------------------------------------------------- +-- Deprecation Warning: tests/warn/rewrite-messages.scala:7:4 ---------------------------------------------------------- 7 | 2 foo 4 // warn | ^^^ | Alphanumeric method foo is not declared infix; it should not be used as infix operator. | Instead, use method syntax .foo(...) or backticked identifier `foo`. | The latter can be rewritten automatically under -rewrite -deprecation. -No warnings can be incurred under -Werror. diff --git a/tests/neg/i15503-scala2/scala2-t11681.scala b/tests/warn/scala2-t11681.scala similarity index 95% rename from tests/neg/i15503-scala2/scala2-t11681.scala rename to tests/warn/scala2-t11681.scala index af11eb4512d6..f7c8c6b02517 100644 --- a/tests/neg/i15503-scala2/scala2-t11681.scala +++ b/tests/warn/scala2-t11681.scala @@ -1,5 +1,5 @@ -//> using options -Xfatal-warnings -Wunused:params -// +//> using options -Wunused:params + import Answers._ @@ -108,5 +108,3 @@ object Answers { } val a$1 = 2 - -// nopo-error: No warnings can be incurred under -Werror. \ No newline at end of file diff --git a/tests/neg/symbolic-packages.check b/tests/warn/symbolic-packages.check similarity index 74% rename from tests/neg/symbolic-packages.check rename to tests/warn/symbolic-packages.check index 4a0e99f22a85..c1d56f67eba7 100644 --- a/tests/neg/symbolic-packages.check +++ b/tests/warn/symbolic-packages.check @@ -1,17 +1,16 @@ --- Warning: tests/neg/symbolic-packages.scala:3:8 ---------------------------------------------------------------------- +-- Warning: tests/warn/symbolic-packages.scala:3:8 --------------------------------------------------------------------- 3 |package `with spaces` { // warn | ^^^^^^^^^^^^^ | The package name `with spaces` will be encoded on the classpath, and can lead to undefined behaviour. --- Warning: tests/neg/symbolic-packages.scala:7:10 --------------------------------------------------------------------- +-- Warning: tests/warn/symbolic-packages.scala:7:10 -------------------------------------------------------------------- 7 |package +.* { // warn // warn | ^ | The package name `*` will be encoded on the classpath, and can lead to undefined behaviour. --- Warning: tests/neg/symbolic-packages.scala:7:8 ---------------------------------------------------------------------- +-- Warning: tests/warn/symbolic-packages.scala:7:8 --------------------------------------------------------------------- 7 |package +.* { // warn // warn | ^ | The package name `+` will be encoded on the classpath, and can lead to undefined behaviour. --- Warning: tests/neg/symbolic-packages.scala:11:16 -------------------------------------------------------------------- +-- Warning: tests/warn/symbolic-packages.scala:11:16 ------------------------------------------------------------------- 11 |package object `mixed_*` { // warn | ^^^^^^^ | The package name `mixed_*` will be encoded on the classpath, and can lead to undefined behaviour. -No warnings can be incurred under -Werror. diff --git a/tests/neg/t3235-minimal.check b/tests/warn/t3235-minimal.check similarity index 81% rename from tests/neg/t3235-minimal.check rename to tests/warn/t3235-minimal.check index 989af71b5355..dcd28466f729 100644 --- a/tests/neg/t3235-minimal.check +++ b/tests/warn/t3235-minimal.check @@ -1,17 +1,16 @@ --- Deprecation Warning: tests/neg/t3235-minimal.scala:5:21 ------------------------------------------------------------- +-- Deprecation Warning: tests/warn/t3235-minimal.scala:5:21 ------------------------------------------------------------ 5 | assert(123456789.round == 123456789) // warn | ^^^^^^^^^^^^^^^ |method round in class RichInt is deprecated since 2.11.0: this is an integer type; there is no reason to round it. Perhaps you meant to call this on a floating-point value? --- Deprecation Warning: tests/neg/t3235-minimal.scala:6:16 ------------------------------------------------------------- +-- Deprecation Warning: tests/warn/t3235-minimal.scala:6:16 ------------------------------------------------------------ 6 | assert(math.round(123456789) == 123456789) // warn | ^^^^^^^^^^ |method round in package scala.math is deprecated since 2.11.0: This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value? --- Deprecation Warning: tests/neg/t3235-minimal.scala:7:32 ------------------------------------------------------------- +-- Deprecation Warning: tests/warn/t3235-minimal.scala:7:32 ------------------------------------------------------------ 7 | assert(1234567890123456789L.round == 1234567890123456789L) // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |method round in class RichLong is deprecated since 2.11.0: this is an integer type; there is no reason to round it. Perhaps you meant to call this on a floating-point value? --- Deprecation Warning: tests/neg/t3235-minimal.scala:8:16 ------------------------------------------------------------- +-- Deprecation Warning: tests/warn/t3235-minimal.scala:8:16 ------------------------------------------------------------ 8 | assert(math.round(1234567890123456789L) == 1234567890123456789L) // warn | ^^^^^^^^^^ |method round in package scala.math is deprecated since 2.11.0: This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value? -No warnings can be incurred under -Werror. diff --git a/tests/neg/warn-value-discard.check b/tests/warn/warn-value-discard.check similarity index 56% rename from tests/neg/warn-value-discard.check rename to tests/warn/warn-value-discard.check index f803179d1c3a..ca6fedb29053 100644 --- a/tests/neg/warn-value-discard.check +++ b/tests/warn/warn-value-discard.check @@ -1,21 +1,20 @@ --- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:27:36 -------------------------------------------- +-- [E175] Potential Issue Warning: tests/warn/warn-value-discard.scala:27:36 ------------------------------------------- 27 | mutable.Set.empty[String].remove("") // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | discarded non-Unit value of type Boolean --- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:39:41 -------------------------------------------- +-- [E175] Potential Issue Warning: tests/warn/warn-value-discard.scala:39:41 ------------------------------------------- 39 | mutable.Set.empty[String].subtractOne("") // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | discarded non-Unit value of type scala.collection.mutable.Set[String] --- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:59:4 --------------------------------------------- +-- [E175] Potential Issue Warning: tests/warn/warn-value-discard.scala:59:4 -------------------------------------------- 59 | mutable.Set.empty[String] += "" // warn | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | discarded non-Unit value of type scala.collection.mutable.Set[String] --- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:15:35 -------------------------------------------- +-- [E175] Potential Issue Warning: tests/warn/warn-value-discard.scala:15:35 ------------------------------------------- 15 | firstThing().map(_ => secondThing()) // warn | ^^^^^^^^^^^^^ | discarded non-Unit value of type Either[Failed, Unit] --- [E175] Potential Issue Warning: tests/neg/warn-value-discard.scala:18:35 -------------------------------------------- +-- [E175] Potential Issue Warning: tests/warn/warn-value-discard.scala:18:35 ------------------------------------------- 18 | firstThing().map(_ => secondThing()) // warn | ^^^^^^^^^^^^^ | discarded non-Unit value of type Either[Failed, Unit] -No warnings can be incurred under -Werror. diff --git a/tests/neg/with-type-operator-future-migration.check b/tests/warn/with-type-operator-future-migration.check similarity index 65% rename from tests/neg/with-type-operator-future-migration.check rename to tests/warn/with-type-operator-future-migration.check index 4dbcd993f242..9ef44edc1884 100644 --- a/tests/neg/with-type-operator-future-migration.check +++ b/tests/warn/with-type-operator-future-migration.check @@ -1,8 +1,7 @@ --- [E003] Syntax Migration Warning: tests/neg/with-type-operator-future-migration.scala:5:13 --------------------------- +-- [E003] Syntax Migration Warning: tests/warn/with-type-operator-future-migration.scala:5:13 -------------------------- 5 |def foo: Int with String = ??? // warn | ^ | with as a type operator has been deprecated; use & instead | This construct can be rewritten automatically under -rewrite -source future-migration. | | longer explanation available when compiling with `-explain` -No warnings can be incurred under -Werror. From dedd819ce375b5a0d4c33c3a4c0892ce0b9e1bd9 Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Tue, 14 Nov 2023 16:31:00 +0100 Subject: [PATCH 08/11] Adjusted one test --- tests/warn/scala2-t11681.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/warn/scala2-t11681.scala b/tests/warn/scala2-t11681.scala index f7c8c6b02517..ae2187181ceb 100644 --- a/tests/warn/scala2-t11681.scala +++ b/tests/warn/scala2-t11681.scala @@ -47,7 +47,6 @@ trait BadAPI extends InterFace { // mustn't alter warnings in super trait PoorClient extends BadAPI { override def meth(x: Int) = ??? // OK - override def f(a: Int, b: String, c: Double): Int = a + b.toInt + c.toInt } class Unusing(u: Int) { // warn From 9dbd8aaf638f6a01f7797040853fb7fa2fdd0254 Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Fri, 17 Nov 2023 15:52:28 +0100 Subject: [PATCH 09/11] Fixes for init tests --- .../dotty/tools/dotc/CompilationTests.scala | 4 +- .../init-global/neg/context-sensitivity.check | 14 +++--- tests/init-global/neg/global-cycle14.check | 26 +++++------ tests/init-global/neg/global-cycle2.check | 14 +++--- tests/init-global/neg/global-cycle3.check | 14 +++--- tests/init-global/neg/global-cycle4.check | 14 +++--- tests/init-global/neg/global-cycle5.check | 10 ++-- tests/init-global/neg/global-cycle6.check | 42 ++++++++--------- tests/init-global/neg/global-cycle7.check | 26 +++++------ tests/init-global/neg/global-cycle8.check | 24 +++++----- .../init-global/neg/global-irrelevance1.check | 10 ++-- .../init-global/neg/global-irrelevance2.check | 17 ++++--- .../init-global/neg/global-irrelevance3.check | 14 +++--- .../init-global/neg/global-irrelevance4.check | 13 +++--- .../init-global/neg/global-irrelevance5.check | 10 ++-- .../init-global/neg/global-irrelevance6.check | 10 ++-- .../init-global/neg/global-irrelevance7.check | 10 ++-- tests/init-global/neg/global-list.check | 46 +++++++++---------- tests/init-global/neg/global-local-var.check | 18 ++++---- tests/init-global/neg/global-region1.check | 12 ++--- tests/init-global/neg/i11262.check | 14 +++--- tests/init-global/neg/i12544b.check | 26 +++++------ tests/init-global/neg/i9176.check | 8 ++-- tests/init-global/neg/mutable-array.check | 10 ++-- tests/init-global/neg/mutable-read1.check | 10 ++-- tests/init-global/neg/mutable-read2.check | 10 ++-- tests/init-global/neg/mutable-read3.check | 10 ++-- tests/init-global/neg/mutable-read4.check | 10 ++-- tests/init-global/neg/mutable-read5.check | 14 +++--- tests/init-global/neg/mutable-read6.check | 14 +++--- tests/init-global/neg/mutable-read7.check | 22 ++++----- tests/init-global/neg/mutable-read8.check | 18 ++++---- tests/init-global/neg/partial-ordering.check | 16 +++---- .../init-global/neg/patmat-unapplySeq2.check | 14 +++--- tests/init-global/neg/patmat.check | 36 +++++++-------- tests/init-global/neg/return.check | 14 +++--- tests/init-global/neg/return2.check | 14 +++--- tests/init-global/neg/t5366.check | 24 +++++----- tests/init-global/neg/t9115.check | 24 +++++----- tests/init-global/neg/t9261.check | 8 ++-- tests/init-global/neg/t9312.check | 40 ++++++++-------- tests/init-global/neg/t9360.check | 24 +++++----- .../neg/unapply-implicit-arg.check | 10 ++-- .../neg/unapply-implicit-arg2.check | 16 +++---- .../neg/unapply-implicit-arg3.check | 22 ++++----- .../neg/unapplySeq-implicit-arg.check | 10 ++-- .../neg/unapplySeq-implicit-arg2.check | 18 ++++---- .../neg/unapplySeq-implicit-arg3.check | 22 ++++----- tests/init-global/{neg => warn}/i18628.scala | 2 +- .../init-global/{neg => warn}/i18628_2.scala | 2 +- .../init-global/{neg => warn}/i18628_3.scala | 2 +- .../init/{neg => warn}/secondary-ctor4.check | 12 ++--- .../init/{neg => warn}/secondary-ctor4.scala | 6 +-- tests/init/{neg => warn}/trait1.scala | 2 +- tests/init/{neg => warn}/trait2.scala | 2 +- tests/neg-custom-args/sourcepath2/hi/A.check | 5 +- tests/neg-custom-args/sourcepath2/hi/A.scala | 3 +- tests/neg/filtering-fors.scala | 21 ++++----- tests/neg/i11225b.check | 6 +++ tests/{warn => neg}/i11225b.scala | 4 +- tests/neg/i18862-3.4.scala | 6 --- tests/neg/i18862-future-migration.scala | 6 --- tests/neg/i18867-3.4.scala | 7 --- tests/neg/i18867.scala | 5 -- tests/neg/infix.check | 30 ++++++++++++ tests/{warn => neg}/infix.scala | 12 ++--- tests/neg/private-this-3.4.scala | 7 --- tests/neg/private-this-future-migration.scala | 7 --- .../refutable-pattern-binding-messages.check | 29 +++++------- .../refutable-pattern-binding-messages.scala | 8 ++-- tests/{neg => warn}/i18862-3.4.check | 4 +- tests/warn/i18862-3.4.scala | 4 ++ tests/warn/i18862-future-migration.scala | 4 ++ tests/warn/i18867-3.4.scala | 5 ++ tests/{neg => warn}/i18867.check | 4 +- tests/warn/i18867.scala | 3 ++ tests/{neg => warn}/private-this-3.4.check | 8 ++-- tests/warn/private-this-3.4.scala | 5 ++ .../warn/private-this-future-migration.scala | 5 ++ tests/warn/rewrite-messages.check | 2 +- tests/{neg => warn}/uninitialized-3.4.check | 4 +- tests/{neg => warn}/uninitialized-3.4.scala | 4 +- .../uninitialized-future-migration.scala | 4 +- .../wildcard-type-syntax-3.4.scala | 4 +- ...ildcard-type-syntax-future-migration.scala | 4 +- 85 files changed, 541 insertions(+), 533 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%) rename tests/init/{neg => warn}/secondary-ctor4.check (84%) rename tests/init/{neg => warn}/secondary-ctor4.scala (90%) rename tests/init/{neg => warn}/trait1.scala (79%) rename tests/init/{neg => warn}/trait2.scala (83%) create mode 100644 tests/neg/i11225b.check rename tests/{warn => neg}/i11225b.scala (68%) delete mode 100644 tests/neg/i18862-3.4.scala delete mode 100644 tests/neg/i18862-future-migration.scala delete mode 100644 tests/neg/i18867-3.4.scala delete mode 100644 tests/neg/i18867.scala create mode 100644 tests/neg/infix.check rename tests/{warn => neg}/infix.scala (82%) delete mode 100644 tests/neg/private-this-3.4.scala delete mode 100644 tests/neg/private-this-future-migration.scala rename tests/{warn => neg}/refutable-pattern-binding-messages.check (65%) rename tests/{warn => neg}/refutable-pattern-binding-messages.scala (65%) rename tests/{neg => warn}/i18862-3.4.check (70%) create mode 100644 tests/warn/i18862-3.4.scala create mode 100644 tests/warn/i18862-future-migration.scala create mode 100644 tests/warn/i18867-3.4.scala rename tests/{neg => warn}/i18867.check (76%) create mode 100644 tests/warn/i18867.scala rename tests/{neg => warn}/private-this-3.4.check (74%) create mode 100644 tests/warn/private-this-3.4.scala create mode 100644 tests/warn/private-this-future-migration.scala rename tests/{neg => warn}/uninitialized-3.4.check (75%) rename tests/{neg => warn}/uninitialized-3.4.scala (60%) rename tests/{neg => warn}/uninitialized-future-migration.scala (62%) rename tests/{neg => warn}/wildcard-type-syntax-3.4.scala (52%) rename tests/{neg => warn}/wildcard-type-syntax-future-migration.scala (53%) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index be8e56bf0ef3..6c78bf8a98dc 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -214,7 +214,7 @@ class CompilationTests { 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/warn", options).checkWarnings() + compileFilesInDir("tests/init-global/warn", defaultOptions.and("-Ysafe-init-global")).checkWarnings() compileFilesInDir("tests/init-global/pos", options).checkCompile() } @@ -223,7 +223,7 @@ class CompilationTests { implicit val testGroup: TestGroup = TestGroup("checkInit") val options = defaultOptions.and("-Ysafe-init", "-Xfatal-warnings") compileFilesInDir("tests/init/neg", options).checkExpectedErrors() - compileFilesInDir("tests/init/warn", options).checkWarnings() + compileFilesInDir("tests/init/warn", defaultOptions.and("-Ysafe-init")).checkWarnings() compileFilesInDir("tests/init/pos", options).checkCompile() compileFilesInDir("tests/init/crash", options.without("-Xfatal-warnings")).checkCompile() // The regression test for i12128 has some atypical classpath requirements. diff --git a/tests/init-global/neg/context-sensitivity.check b/tests/init-global/neg/context-sensitivity.check index 4c7e679685a1..e5eaad3d2a58 100644 --- a/tests/init-global/neg/context-sensitivity.check +++ b/tests/init-global/neg/context-sensitivity.check @@ -1,11 +1,11 @@ -- Warning: tests/init-global/neg/context-sensitivity.scala:9:21 ------------------------------------------------------- 9 | def foo(): Int = A.m | ^^^ - | Access uninitialized field value m. Call trace: - | -> object A: [ context-sensitivity.scala:14 ] - | ^ - | -> val m: Int = box1.value.foo() [ context-sensitivity.scala:17 ] - | ^^^^^^^^^^^^^^^^ - | -> def foo(): Int = A.m [ context-sensitivity.scala:9 ] - | ^^^ + | Access uninitialized field value m. Calling trace: + | ├── object A: [ context-sensitivity.scala:14 ] + | │ ^ + | ├── val m: Int = box1.value.foo() [ context-sensitivity.scala:17 ] + | │ ^^^^^^^^^^^^^^^^ + | └── def foo(): Int = A.m [ context-sensitivity.scala:9 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle14.check b/tests/init-global/neg/global-cycle14.check index 29c28fbd1bc4..d976653c05f0 100644 --- a/tests/init-global/neg/global-cycle14.check +++ b/tests/init-global/neg/global-cycle14.check @@ -2,20 +2,20 @@ 8 |object A { | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | -> object A { [ global-cycle14.scala:8 ] - | ^ - | -> val n: Int = B.m [ global-cycle14.scala:9 ] - | ^ - | -> object B { [ global-cycle14.scala:12 ] - | ^ - | -> val m: Int = A.n [ global-cycle14.scala:13 ] - | ^ + | ├── object A { [ global-cycle14.scala:8 ] + | │ ^ + | ├── val n: Int = B.m [ global-cycle14.scala:9 ] + | │ ^ + | ├── object B { [ global-cycle14.scala:12 ] + | │ ^ + | └── val m: Int = A.n [ global-cycle14.scala:13 ] + | ^ -- Warning: tests/init-global/neg/global-cycle14.scala:13:17 ----------------------------------------------------------- 13 | val m: Int = A.n | ^^^ - | Access uninitialized field value n. Call trace: - | -> object B { [ global-cycle14.scala:12 ] - | ^ - | -> val m: Int = A.n [ global-cycle14.scala:13 ] - | ^^^ + | Access uninitialized field value n. Calling trace: + | ├── object B { [ global-cycle14.scala:12 ] + | │ ^ + | └── val m: Int = A.n [ global-cycle14.scala:13 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle2.check b/tests/init-global/neg/global-cycle2.check index 96bedda57cb5..e01fb2f15aea 100644 --- a/tests/init-global/neg/global-cycle2.check +++ b/tests/init-global/neg/global-cycle2.check @@ -1,11 +1,11 @@ -- Warning: tests/init-global/neg/global-cycle2.scala:6:21 ------------------------------------------------------------- 6 | def foo(): Int = A.a * 2 | ^^^ - | Access uninitialized field value a. Call trace: - | -> object A { [ global-cycle2.scala:1 ] - | ^ - | -> val a: Int = B.foo() [ global-cycle2.scala:2 ] - | ^^^^^^^ - | -> def foo(): Int = A.a * 2 [ global-cycle2.scala:6 ] - | ^^^ + | Access uninitialized field value a. Calling trace: + | ├── object A { [ global-cycle2.scala:1 ] + | │ ^ + | ├── val a: Int = B.foo() [ global-cycle2.scala:2 ] + | │ ^^^^^^^ + | └── def foo(): Int = A.a * 2 [ global-cycle2.scala:6 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle3.check b/tests/init-global/neg/global-cycle3.check index c8caac77ac40..1b3ccd8dd857 100644 --- a/tests/init-global/neg/global-cycle3.check +++ b/tests/init-global/neg/global-cycle3.check @@ -1,11 +1,11 @@ -- Warning: tests/init-global/neg/global-cycle3.scala:2:21 ------------------------------------------------------------- 2 | def foo(): Int = B.a + 10 | ^^^ - | Access uninitialized field value a. Call trace: - | -> object B { [ global-cycle3.scala:5 ] - | ^ - | -> val a: Int = A(4).foo() [ global-cycle3.scala:6 ] - | ^^^^^^^^^^ - | -> def foo(): Int = B.a + 10 [ global-cycle3.scala:2 ] - | ^^^ + | Access uninitialized field value a. Calling trace: + | ├── object B { [ global-cycle3.scala:5 ] + | │ ^ + | ├── val a: Int = A(4).foo() [ global-cycle3.scala:6 ] + | │ ^^^^^^^^^^ + | └── def foo(): Int = B.a + 10 [ global-cycle3.scala:2 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle4.check b/tests/init-global/neg/global-cycle4.check index 39c08224c7ba..68a4dcae4b77 100644 --- a/tests/init-global/neg/global-cycle4.check +++ b/tests/init-global/neg/global-cycle4.check @@ -1,11 +1,11 @@ -- Warning: tests/init-global/neg/global-cycle4.scala:10:21 ------------------------------------------------------------ 10 | def foo(): Int = O.a + 10 | ^^^ - | Access uninitialized field value a. Call trace: - | -> object O { [ global-cycle4.scala:17 ] - | ^ - | -> val a: Int = D(5).bar().foo() [ global-cycle4.scala:18 ] - | ^^^^^^^^^^^^^^^^ - | -> def foo(): Int = O.a + 10 [ global-cycle4.scala:10 ] - | ^^^ + | Access uninitialized field value a. Calling trace: + | ├── object O { [ global-cycle4.scala:17 ] + | │ ^ + | ├── val a: Int = D(5).bar().foo() [ global-cycle4.scala:18 ] + | │ ^^^^^^^^^^^^^^^^ + | └── def foo(): Int = O.a + 10 [ global-cycle4.scala:10 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle5.check b/tests/init-global/neg/global-cycle5.check index 494fed8a7dd3..c1d21cb77a45 100644 --- a/tests/init-global/neg/global-cycle5.check +++ b/tests/init-global/neg/global-cycle5.check @@ -2,9 +2,9 @@ 10 | val b: Int = A.a.foo() | ^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B { [ global-cycle5.scala:9 ] - | ^ - |-> val b: Int = A.a.foo() [ global-cycle5.scala:10 ] - | ^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B { [ global-cycle5.scala:9 ] + |│ ^ + |└── val b: Int = A.a.foo() [ global-cycle5.scala:10 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle6.check b/tests/init-global/neg/global-cycle6.check index 5790b84bdb03..47a1c1543773 100644 --- a/tests/init-global/neg/global-cycle6.check +++ b/tests/init-global/neg/global-cycle6.check @@ -2,28 +2,28 @@ 1 |object A { | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | -> object A { [ global-cycle6.scala:1 ] - | ^ - | -> val n: Int = B.m [ global-cycle6.scala:2 ] - | ^ - | -> object B { [ global-cycle6.scala:8 ] - | ^ - | -> val a = new A.Inner [ global-cycle6.scala:9 ] - | ^^^^^^^^^^^ - | -> class Inner { [ global-cycle6.scala:3 ] - | ^ - | -> println(n) [ global-cycle6.scala:4 ] - | ^ + | ├── object A { [ global-cycle6.scala:1 ] + | │ ^ + | ├── val n: Int = B.m [ global-cycle6.scala:2 ] + | │ ^ + | ├── object B { [ global-cycle6.scala:8 ] + | │ ^ + | ├── val a = new A.Inner [ global-cycle6.scala:9 ] + | │ ^^^^^^^^^^^ + | ├── class Inner { [ global-cycle6.scala:3 ] + | │ ^ + | └── println(n) [ global-cycle6.scala:4 ] + | ^ -- Warning: tests/init-global/neg/global-cycle6.scala:4:12 ------------------------------------------------------------- 4 | println(n) | ^ - | Access uninitialized field value n. Call trace: - | -> object B { [ global-cycle6.scala:8 ] - | ^ - | -> val a = new A.Inner [ global-cycle6.scala:9 ] - | ^^^^^^^^^^^ - | -> class Inner { [ global-cycle6.scala:3 ] - | ^ - | -> println(n) [ global-cycle6.scala:4 ] - | ^ + | Access uninitialized field value n. Calling trace: + | ├── object B { [ global-cycle6.scala:8 ] + | │ ^ + | ├── val a = new A.Inner [ global-cycle6.scala:9 ] + | │ ^^^^^^^^^^^ + | ├── class Inner { [ global-cycle6.scala:3 ] + | │ ^ + | └── println(n) [ global-cycle6.scala:4 ] + | ^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle7.check b/tests/init-global/neg/global-cycle7.check index e55192ebea8c..96a63b77b73e 100644 --- a/tests/init-global/neg/global-cycle7.check +++ b/tests/init-global/neg/global-cycle7.check @@ -2,20 +2,20 @@ 1 |object A { | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | -> object A { [ global-cycle7.scala:1 ] - | ^ - | -> val n: Int = B.m [ global-cycle7.scala:2 ] - | ^ - | -> object B { [ global-cycle7.scala:5 ] - | ^ - | -> val m: Int = A.n [ global-cycle7.scala:6 ] - | ^ + | ├── object A { [ global-cycle7.scala:1 ] + | │ ^ + | ├── val n: Int = B.m [ global-cycle7.scala:2 ] + | │ ^ + | ├── object B { [ global-cycle7.scala:5 ] + | │ ^ + | └── val m: Int = A.n [ global-cycle7.scala:6 ] + | ^ -- Warning: tests/init-global/neg/global-cycle7.scala:6:17 ------------------------------------------------------------- 6 | val m: Int = A.n | ^^^ - | Access uninitialized field value n. Call trace: - | -> object B { [ global-cycle7.scala:5 ] - | ^ - | -> val m: Int = A.n [ global-cycle7.scala:6 ] - | ^^^ + | Access uninitialized field value n. Calling trace: + | ├── object B { [ global-cycle7.scala:5 ] + | │ ^ + | └── val m: Int = A.n [ global-cycle7.scala:6 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-cycle8.check b/tests/init-global/neg/global-cycle8.check index b19272294bd5..6dc544fe8e7c 100644 --- a/tests/init-global/neg/global-cycle8.check +++ b/tests/init-global/neg/global-cycle8.check @@ -2,16 +2,16 @@ 9 |object O { | ^ | Cyclic initialization: object O -> object P -> object O. Calling trace: - | -> object O { [ global-cycle8.scala:9 ] - | ^ - | -> println(P.m) [ global-cycle8.scala:11 ] - | ^ - | -> object P { [ global-cycle8.scala:14 ] - | ^ - | -> val m = Q.bar(new B) [ global-cycle8.scala:15 ] - | ^^^^^^^^^^^^ - | -> def bar(b: B) = b.a.foo() [ global-cycle8.scala:19 ] - | ^^^^^^^^^ - | -> def foo() = println(O.n) [ global-cycle8.scala:2 ] - | ^ + | ├── object O { [ global-cycle8.scala:9 ] + | │ ^ + | ├── println(P.m) [ global-cycle8.scala:11 ] + | │ ^ + | ├── object P { [ global-cycle8.scala:14 ] + | │ ^ + | ├── val m = Q.bar(new B) [ global-cycle8.scala:15 ] + | │ ^^^^^^^^^^^^ + | ├── def bar(b: B) = b.a.foo() [ global-cycle8.scala:19 ] + | │ ^^^^^^^^^ + | └── def foo() = println(O.n) [ global-cycle8.scala:2 ] + | ^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance1.check b/tests/init-global/neg/global-irrelevance1.check index 2f09978e3585..799d80ec9623 100644 --- a/tests/init-global/neg/global-irrelevance1.check +++ b/tests/init-global/neg/global-irrelevance1.check @@ -2,9 +2,9 @@ 5 | var y = A.x * 2 | ^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ global-irrelevance1.scala:4 ] - | ^ - |-> var y = A.x * 2 [ global-irrelevance1.scala:5 ] - | ^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ global-irrelevance1.scala:4 ] + |│ ^ + |└── var y = A.x * 2 [ global-irrelevance1.scala:5 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance2.check b/tests/init-global/neg/global-irrelevance2.check index ab43e2c977ab..56263b936308 100644 --- a/tests/init-global/neg/global-irrelevance2.check +++ b/tests/init-global/neg/global-irrelevance2.check @@ -3,13 +3,12 @@ | ^^^^^^^^^^^^ | Mutating object A during initialization of object B. | Mutating other static objects during the initialization of one static object is forbidden. Calling trace: - | - | -> object B: [ global-irrelevance2.scala:7 ] - | ^ - | -> new B(10) [ global-irrelevance2.scala:8 ] - | ^^^^^^^^^ - | -> class B(b: Int): [ global-irrelevance2.scala:4 ] - | ^ - | -> A.x = b * 2 [ global-irrelevance2.scala:5 ] - | ^^^^^^^^^^^^ + | ├── object B: [ global-irrelevance2.scala:7 ] + | │ ^ + | ├── new B(10) [ global-irrelevance2.scala:8 ] + | │ ^^^^^^^^^ + | ├── class B(b: Int): [ global-irrelevance2.scala:4 ] + | │ ^ + | └── A.x = b * 2 [ global-irrelevance2.scala:5 ] + | ^^^^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance3.check b/tests/init-global/neg/global-irrelevance3.check index 30abdff5da2a..7d7f9dbfb1fc 100644 --- a/tests/init-global/neg/global-irrelevance3.check +++ b/tests/init-global/neg/global-irrelevance3.check @@ -2,11 +2,11 @@ 9 | (() => x) | ^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ global-irrelevance3.scala:13 ] - | ^ - |-> var y = A.p.g() [ global-irrelevance3.scala:14 ] - | ^^^^^^^ - |-> (() => x) [ global-irrelevance3.scala:9 ] - | ^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ global-irrelevance3.scala:13 ] + |│ ^ + |├── var y = A.p.g() [ global-irrelevance3.scala:14 ] + |│ ^^^^^^^ + |└── (() => x) [ global-irrelevance3.scala:9 ] + | ^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance4.check b/tests/init-global/neg/global-irrelevance4.check index 447ca27a4ed3..ebabde96294d 100644 --- a/tests/init-global/neg/global-irrelevance4.check +++ b/tests/init-global/neg/global-irrelevance4.check @@ -3,11 +3,10 @@ | ^^^^^^^^^^ | Mutating object A during initialization of object B. | Mutating other static objects during the initialization of one static object is forbidden. Calling trace: - | - | -> object B: [ global-irrelevance4.scala:12 ] - | ^ - | -> A.p.f(10) [ global-irrelevance4.scala:13 ] - | ^^^^^^^^^ - | -> (y => x = y), [ global-irrelevance4.scala:8 ] - | ^^^^^^^^^^ + | ├── object B: [ global-irrelevance4.scala:12 ] + | │ ^ + | ├── A.p.f(10) [ global-irrelevance4.scala:13 ] + | │ ^^^^^^^^^ + | └── (y => x = y), [ global-irrelevance4.scala:8 ] + | ^^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance5.check b/tests/init-global/neg/global-irrelevance5.check index af8a6ab6568d..7d472621821c 100644 --- a/tests/init-global/neg/global-irrelevance5.check +++ b/tests/init-global/neg/global-irrelevance5.check @@ -2,9 +2,9 @@ 6 | var y = A.array(0) * 2 | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ global-irrelevance5.scala:5 ] - | ^ - |-> var y = A.array(0) * 2 [ global-irrelevance5.scala:6 ] - | ^^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ global-irrelevance5.scala:5 ] + |│ ^ + |└── var y = A.array(0) * 2 [ global-irrelevance5.scala:6 ] + | ^^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance6.check b/tests/init-global/neg/global-irrelevance6.check index 8b30051e67b8..52df6bd253e2 100644 --- a/tests/init-global/neg/global-irrelevance6.check +++ b/tests/init-global/neg/global-irrelevance6.check @@ -2,9 +2,9 @@ 9 | var y = A.array(0).foo() * 2 | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ global-irrelevance6.scala:8 ] - | ^ - |-> var y = A.array(0).foo() * 2 [ global-irrelevance6.scala:9 ] - | ^^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ global-irrelevance6.scala:8 ] + |│ ^ + |└── var y = A.array(0).foo() * 2 [ global-irrelevance6.scala:9 ] + | ^^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-irrelevance7.check b/tests/init-global/neg/global-irrelevance7.check index 37fab85ca045..3178c21cbca5 100644 --- a/tests/init-global/neg/global-irrelevance7.check +++ b/tests/init-global/neg/global-irrelevance7.check @@ -2,9 +2,9 @@ 10 | var y = A.array(0).foo() * 2 | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ global-irrelevance7.scala:9 ] - | ^ - |-> var y = A.array(0).foo() * 2 [ global-irrelevance7.scala:10 ] - | ^^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ global-irrelevance7.scala:9 ] + |│ ^ + |└── var y = A.array(0).foo() * 2 [ global-irrelevance7.scala:10 ] + | ^^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-list.check b/tests/init-global/neg/global-list.check index 806f61b4c570..4d4bc3d7e8ca 100644 --- a/tests/init-global/neg/global-list.check +++ b/tests/init-global/neg/global-list.check @@ -2,36 +2,36 @@ 3 |object O: | ^ | Cyclic initialization: object O -> object Foo -> object O. Calling trace: - | -> object O: [ global-list.scala:3 ] - | ^ - | -> val a = Foo("Apple") [ global-list.scala:4 ] - | ^^^ - | -> object Foo: [ global-list.scala:8 ] - | ^ - | -> val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] - | ^ + | ├── object O: [ global-list.scala:3 ] + | │ ^ + | ├── val a = Foo("Apple") [ global-list.scala:4 ] + | │ ^^^ + | ├── object Foo: [ global-list.scala:8 ] + | │ ^ + | └── val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] + | ^ -- Warning: tests/init-global/neg/global-list.scala:9:30 --------------------------------------------------------------- 9 | val all: List[Foo] = List(O.a, O.b, O.c) | ^^^ - | Access uninitialized field value a. Call trace: - | -> object Foo: [ global-list.scala:8 ] - | ^ - | -> val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] - | ^^^ + | Access uninitialized field value a. Calling trace: + | ├── object Foo: [ global-list.scala:8 ] + | │ ^ + | └── val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] + | ^^^ -- Warning: tests/init-global/neg/global-list.scala:9:35 --------------------------------------------------------------- 9 | val all: List[Foo] = List(O.a, O.b, O.c) | ^^^ - | Access uninitialized field value b. Call trace: - | -> object Foo: [ global-list.scala:8 ] - | ^ - | -> val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] - | ^^^ + | Access uninitialized field value b. Calling trace: + | ├── object Foo: [ global-list.scala:8 ] + | │ ^ + | └── val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] + | ^^^ -- Warning: tests/init-global/neg/global-list.scala:9:40 --------------------------------------------------------------- 9 | val all: List[Foo] = List(O.a, O.b, O.c) | ^^^ - | Access uninitialized field value c. Call trace: - | -> object Foo: [ global-list.scala:8 ] - | ^ - | -> val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] - | ^^^ + | Access uninitialized field value c. Calling trace: + | ├── object Foo: [ global-list.scala:8 ] + | │ ^ + | └── val all: List[Foo] = List(O.a, O.b, O.c) [ global-list.scala:9 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-local-var.check b/tests/init-global/neg/global-local-var.check index 765e727f58e8..bbedc06dce3d 100644 --- a/tests/init-global/neg/global-local-var.check +++ b/tests/init-global/neg/global-local-var.check @@ -1,13 +1,13 @@ -- Warning: tests/init-global/neg/global-local-var.scala:10:6 ---------------------------------------------------------- 10 | B.a + 10 + sum | ^^^ - | Access uninitialized field value a. Call trace: - | -> object B { [ global-local-var.scala:14 ] - | ^ - | -> val a: Int = A(4).foo() [ global-local-var.scala:15 ] - | ^^^^^^^^^^ - | -> def foo(): Int = { [ global-local-var.scala:2 ] - | ^ - | -> B.a + 10 + sum [ global-local-var.scala:10 ] - | ^^^ + | Access uninitialized field value a. Calling trace: + | ├── object B { [ global-local-var.scala:14 ] + | │ ^ + | ├── val a: Int = A(4).foo() [ global-local-var.scala:15 ] + | │ ^^^^^^^^^^ + | ├── def foo(): Int = { [ global-local-var.scala:2 ] + | │ ^ + | └── B.a + 10 + sum [ global-local-var.scala:10 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/global-region1.check b/tests/init-global/neg/global-region1.check index 25a5359e30a2..b3b7e2a3b7ca 100644 --- a/tests/init-global/neg/global-region1.check +++ b/tests/init-global/neg/global-region1.check @@ -1,11 +1,11 @@ -- Warning: tests/init-global/neg/global-region1.scala:3:51 ------------------------------------------------------------ 3 |class D(var y: Int) extends B { def foo(): Int = A.m } | ^^^ - | Access uninitialized field value m. Call trace: - | -> object A: [ global-region1.scala:6 ] - | ^ - | -> val m: Int = box1.value.foo() [ global-region1.scala:9 ] - | ^^^^^^^^^^^^^^^^ - | -> class D(var y: Int) extends B { def foo(): Int = A.m } [ global-region1.scala:3 ] + | Access uninitialized field value m. Calling trace: + | ├── object A: [ global-region1.scala:6 ] + | │ ^ + | ├── val m: Int = box1.value.foo() [ global-region1.scala:9 ] + | │ ^^^^^^^^^^^^^^^^ + | └── class D(var y: Int) extends B { def foo(): Int = A.m } [ global-region1.scala:3 ] | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/i11262.check b/tests/init-global/neg/i11262.check index abb72702722c..643a70838167 100644 --- a/tests/init-global/neg/i11262.check +++ b/tests/init-global/neg/i11262.check @@ -2,14 +2,14 @@ 1 |object A { val x: String = B.y } | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | -> object A { val x: String = B.y } [ i11262.scala:1 ] - | ^ - | -> object B { val y: String = A.x } [ i11262.scala:2 ] - | ^ + | ├── object A { val x: String = B.y } [ i11262.scala:1 ] + | │ ^ + | └── object B { val y: String = A.x } [ i11262.scala:2 ] + | ^ -- Warning: tests/init-global/neg/i11262.scala:2:29 -------------------------------------------------------------------- 2 |object B { val y: String = A.x } | ^^^ - | Access uninitialized field value x. Call trace: - | -> object B { val y: String = A.x } [ i11262.scala:2 ] - | ^^^ + | Access uninitialized field value x. Calling trace: + | └── object B { val y: String = A.x } [ i11262.scala:2 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/i12544b.check b/tests/init-global/neg/i12544b.check index fa03c4a2a336..7680b62d0b7b 100644 --- a/tests/init-global/neg/i12544b.check +++ b/tests/init-global/neg/i12544b.check @@ -2,20 +2,20 @@ 5 | object nested: | ^ | Cyclic initialization: object nested -> object Enum -> object nested. Calling trace: - | -> object nested: [ i12544b.scala:5 ] - | ^ - | -> val a: Enum = Case [ i12544b.scala:6 ] - | ^^^^ - | -> object Enum: [ i12544b.scala:4 ] - | ^ - | -> val b: Enum = f(nested.a) [ i12544b.scala:8 ] - | ^^^^^^ + | ├── object nested: [ i12544b.scala:5 ] + | │ ^ + | ├── val a: Enum = Case [ i12544b.scala:6 ] + | │ ^^^^ + | ├── object Enum: [ i12544b.scala:4 ] + | │ ^ + | └── val b: Enum = f(nested.a) [ i12544b.scala:8 ] + | ^^^^^^ -- Warning: tests/init-global/neg/i12544b.scala:8:25 ------------------------------------------------------------------- 8 | val b: Enum = f(nested.a) | ^^^^^^^^ - | Access uninitialized field value a. Call trace: - | -> object Enum: [ i12544b.scala:4 ] - | ^ - | -> val b: Enum = f(nested.a) [ i12544b.scala:8 ] - | ^^^^^^^^ + | Access uninitialized field value a. Calling trace: + | ├── object Enum: [ i12544b.scala:4 ] + | │ ^ + | └── val b: Enum = f(nested.a) [ i12544b.scala:8 ] + | ^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/i9176.check b/tests/init-global/neg/i9176.check index 92f9e31288bc..a26b66081d75 100644 --- a/tests/init-global/neg/i9176.check +++ b/tests/init-global/neg/i9176.check @@ -2,8 +2,8 @@ 2 |case object A extends Foo(B) | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | -> case object A extends Foo(B) [ i9176.scala:2 ] - | ^ - | -> case object B extends Foo(A) [ i9176.scala:3 ] - | ^ + | ├── case object A extends Foo(B) [ i9176.scala:2 ] + | │ ^ + | └── case object B extends Foo(A) [ i9176.scala:3 ] + | ^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-array.check b/tests/init-global/neg/mutable-array.check index 794ace19f512..9a877be4eff4 100644 --- a/tests/init-global/neg/mutable-array.check +++ b/tests/init-global/neg/mutable-array.check @@ -2,9 +2,9 @@ 8 | val x: Int = box.value | ^^^^^^^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ mutable-array.scala:5 ] - | ^ - |-> val x: Int = box.value [ mutable-array.scala:8 ] - | ^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ mutable-array.scala:5 ] + |│ ^ + |└── val x: Int = box.value [ mutable-array.scala:8 ] + | ^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read1.check b/tests/init-global/neg/mutable-read1.check index 159f01985eea..4e446490d7e5 100644 --- a/tests/init-global/neg/mutable-read1.check +++ b/tests/init-global/neg/mutable-read1.check @@ -2,9 +2,9 @@ 10 | val n: Int = boxA.value | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ mutable-read1.scala:6 ] - | ^ - |-> val n: Int = boxA.value [ mutable-read1.scala:10 ] - | ^^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ mutable-read1.scala:6 ] + |│ ^ + |└── val n: Int = boxA.value [ mutable-read1.scala:10 ] + | ^^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read2.check b/tests/init-global/neg/mutable-read2.check index 1bb8e07c0429..24c3c0ef3789 100644 --- a/tests/init-global/neg/mutable-read2.check +++ b/tests/init-global/neg/mutable-read2.check @@ -2,9 +2,9 @@ 10 | val b: Int = box.value | ^^^^^^^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ mutable-read2.scala:7 ] - | ^ - |-> val b: Int = box.value [ mutable-read2.scala:10 ] - | ^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ mutable-read2.scala:7 ] + |│ ^ + |└── val b: Int = box.value [ mutable-read2.scala:10 ] + | ^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read3.check b/tests/init-global/neg/mutable-read3.check index d0e194093f2e..e0eeb62cee63 100644 --- a/tests/init-global/neg/mutable-read3.check +++ b/tests/init-global/neg/mutable-read3.check @@ -2,9 +2,9 @@ 9 | val x: Int = box.value | ^^^^^^^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ mutable-read3.scala:5 ] - | ^ - |-> val x: Int = box.value [ mutable-read3.scala:9 ] - | ^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ mutable-read3.scala:5 ] + |│ ^ + |└── val x: Int = box.value [ mutable-read3.scala:9 ] + | ^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read4.check b/tests/init-global/neg/mutable-read4.check index 9ed8f6d6c49d..81f3a68e0f8b 100644 --- a/tests/init-global/neg/mutable-read4.check +++ b/tests/init-global/neg/mutable-read4.check @@ -2,9 +2,9 @@ 10 | val n: Int = boxA.value | ^^^^^^^^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ mutable-read4.scala:6 ] - | ^ - |-> val n: Int = boxA.value [ mutable-read4.scala:10 ] - | ^^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ mutable-read4.scala:6 ] + |│ ^ + |└── val n: Int = boxA.value [ mutable-read4.scala:10 ] + | ^^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read5.check b/tests/init-global/neg/mutable-read5.check index 6b84d329188a..0fa788588d97 100644 --- a/tests/init-global/neg/mutable-read5.check +++ b/tests/init-global/neg/mutable-read5.check @@ -2,11 +2,11 @@ 4 | def name(s: String): Name = Name(0, chrs.length) | ^^^^ |Reading mutable state of object Names during initialization of object StdNames. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object StdNames: [ mutable-read5.scala:6 ] - | ^ - |-> val AnyRef: Names.Name = Names.name("AnyRef") [ mutable-read5.scala:7 ] - | ^^^^^^^^^^^^^^^^^^^^ - |-> def name(s: String): Name = Name(0, chrs.length) [ mutable-read5.scala:4 ] - | ^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object StdNames: [ mutable-read5.scala:6 ] + |│ ^ + |├── val AnyRef: Names.Name = Names.name("AnyRef") [ mutable-read5.scala:7 ] + |│ ^^^^^^^^^^^^^^^^^^^^ + |└── def name(s: String): Name = Name(0, chrs.length) [ mutable-read5.scala:4 ] + | ^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read6.check b/tests/init-global/neg/mutable-read6.check index ceb2928ba654..a43e62bafae0 100644 --- a/tests/init-global/neg/mutable-read6.check +++ b/tests/init-global/neg/mutable-read6.check @@ -2,11 +2,11 @@ 7 | final def source: SourceFile = _source | ^^^^^^^ |Reading mutable state of object Contexts during initialization of object Implicits. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object Implicits: [ mutable-read6.scala:12 ] - | ^ - |-> val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source) [ mutable-read6.scala:15 ] - | ^^^^^^^^^^^^^^^^ - |-> final def source: SourceFile = _source [ mutable-read6.scala:7 ] - | ^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object Implicits: [ mutable-read6.scala:12 ] + |│ ^ + |├── val NoMatchingFailure: SearchFailure = SearchFailure(1, NoContext.source) [ mutable-read6.scala:15 ] + |│ ^^^^^^^^^^^^^^^^ + |└── final def source: SourceFile = _source [ mutable-read6.scala:7 ] + | ^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read7.check b/tests/init-global/neg/mutable-read7.check index fd7139b14b19..5198721ebf40 100644 --- a/tests/init-global/neg/mutable-read7.check +++ b/tests/init-global/neg/mutable-read7.check @@ -2,15 +2,15 @@ 7 | if (Positioned.debug) { | ^^^^^^^^^^^^^^^^ |Reading mutable state of object Positioned during initialization of object Trees. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object Trees: [ mutable-read7.scala:11 ] - | ^ - |-> val emptyTree = new Tree [ mutable-read7.scala:13 ] - | ^^^^^^^^ - |-> class Tree extends Positioned [ mutable-read7.scala:12 ] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - |-> abstract class Positioned: [ mutable-read7.scala:6 ] - | ^ - |-> if (Positioned.debug) { [ mutable-read7.scala:7 ] - | ^^^^^^^^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object Trees: [ mutable-read7.scala:11 ] + |│ ^ + |├── val emptyTree = new Tree [ mutable-read7.scala:13 ] + |│ ^^^^^^^^ + |├── class Tree extends Positioned [ mutable-read7.scala:12 ] + |│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + |├── abstract class Positioned: [ mutable-read7.scala:6 ] + |│ ^ + |└── if (Positioned.debug) { [ mutable-read7.scala:7 ] + | ^^^^^^^^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/mutable-read8.check b/tests/init-global/neg/mutable-read8.check index 3598228f24a9..030208a605dd 100644 --- a/tests/init-global/neg/mutable-read8.check +++ b/tests/init-global/neg/mutable-read8.check @@ -2,13 +2,13 @@ 6 | if (Stats.monitored) println("record stats") | ^^^^^^^^^^^^^^^ |Reading mutable state of object Stats during initialization of object NoCompleter. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object NoCompleter extends LazyType [ mutable-read8.scala:11 ] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - |-> class LazyType extends UncachedGroundType [ mutable-read8.scala:9 ] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - |-> class UncachedGroundType { [ mutable-read8.scala:5 ] - | ^ - |-> if (Stats.monitored) println("record stats") [ mutable-read8.scala:6 ] - | ^^^^^^^^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object NoCompleter extends LazyType [ mutable-read8.scala:11 ] + |│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + |├── class LazyType extends UncachedGroundType [ mutable-read8.scala:9 ] + |│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + |├── class UncachedGroundType { [ mutable-read8.scala:5 ] + |│ ^ + |└── if (Stats.monitored) println("record stats") [ mutable-read8.scala:6 ] + | ^^^^^^^^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/partial-ordering.check b/tests/init-global/neg/partial-ordering.check index 5db1fdc9d873..d7a71995dd4c 100644 --- a/tests/init-global/neg/partial-ordering.check +++ b/tests/init-global/neg/partial-ordering.check @@ -2,12 +2,12 @@ 1 |object Names: | ^ | Cyclic initialization: object Names -> object MethodName -> object Names. Calling trace: - | -> object Names: [ partial-ordering.scala:1 ] - | ^ - | -> val ctorName: MethodName = MethodName.apply(ctorString) [ partial-ordering.scala:3 ] - | ^^^^^^^^^^ - | -> object MethodName: [ partial-ordering.scala:6 ] - | ^ - | -> val ctor: MethodName = new MethodName(Names.ctorString) [ partial-ordering.scala:7 ] - | ^^^^^ + | ├── object Names: [ partial-ordering.scala:1 ] + | │ ^ + | ├── val ctorName: MethodName = MethodName.apply(ctorString) [ partial-ordering.scala:3 ] + | │ ^^^^^^^^^^ + | ├── object MethodName: [ partial-ordering.scala:6 ] + | │ ^ + | └── val ctor: MethodName = new MethodName(Names.ctorString) [ partial-ordering.scala:7 ] + | ^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/patmat-unapplySeq2.check b/tests/init-global/neg/patmat-unapplySeq2.check index a545af8e9dee..57a67452c10f 100644 --- a/tests/init-global/neg/patmat-unapplySeq2.check +++ b/tests/init-global/neg/patmat-unapplySeq2.check @@ -2,11 +2,11 @@ 8 | def apply(i: Int): Box = array(i) | ^^^^^^^^ |Reading mutable state of object A during initialization of object B. - |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: - |-> object B: [ patmat-unapplySeq2.scala:15 ] - | ^ - |-> case A(b*) => [ patmat-unapplySeq2.scala:17 ] - | ^^^^^ - |-> def apply(i: Int): Box = array(i) [ patmat-unapplySeq2.scala:8 ] - | ^^^^^^^^ + |Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace: + |├── object B: [ patmat-unapplySeq2.scala:15 ] + |│ ^ + |├── case A(b*) => [ patmat-unapplySeq2.scala:17 ] + |│ ^^^^^ + |└── def apply(i: Int): Box = array(i) [ patmat-unapplySeq2.scala:8 ] + | ^^^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/patmat.check b/tests/init-global/neg/patmat.check index 9c77fb554aae..e05d144db7ce 100644 --- a/tests/init-global/neg/patmat.check +++ b/tests/init-global/neg/patmat.check @@ -2,26 +2,26 @@ 1 |object A: | ^ | Cyclic initialization: object A -> object B -> object A. Calling trace: - | -> object A: [ patmat.scala:1 ] - | ^ - | -> case Some(x) => println(x * 2 + B.a.size) [ patmat.scala:4 ] - | ^ - | -> object B: [ patmat.scala:7 ] - | ^ - | -> if A.a.isEmpty then println(xs.size) [ patmat.scala:12 ] - | ^ + | ├── object A: [ patmat.scala:1 ] + | │ ^ + | ├── case Some(x) => println(x * 2 + B.a.size) [ patmat.scala:4 ] + | │ ^ + | ├── object B: [ patmat.scala:7 ] + | │ ^ + | └── if A.a.isEmpty then println(xs.size) [ patmat.scala:12 ] + | ^ -- Warning: tests/init-global/neg/patmat.scala:29:9 -------------------------------------------------------------------- 29 | object Inner: | ^ | Cyclic initialization: object Inner -> object C -> object Inner. Calling trace: - | -> object Inner: [ patmat.scala:29 ] - | ^ - | -> case Box(f) => f() [ patmat.scala:35 ] - | ^^^ - | -> val foo: () => Int = () => C.a [ patmat.scala:32 ] - | ^ - | -> object C: [ patmat.scala:18 ] - | ^ - | -> val a: Int = Inner.b [ patmat.scala:27 ] - | ^^^^^ + | ├── object Inner: [ patmat.scala:29 ] + | │ ^ + | ├── case Box(f) => f() [ patmat.scala:35 ] + | │ ^^^ + | ├── val foo: () => Int = () => C.a [ patmat.scala:32 ] + | │ ^ + | ├── object C: [ patmat.scala:18 ] + | │ ^ + | └── val a: Int = Inner.b [ patmat.scala:27 ] + | ^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/return.check b/tests/init-global/neg/return.check index 158913326a9a..a420b2bab4c3 100644 --- a/tests/init-global/neg/return.check +++ b/tests/init-global/neg/return.check @@ -1,11 +1,11 @@ -- Warning: tests/init-global/neg/return.scala:4:31 -------------------------------------------------------------------- 4 | return (a: Int) => a + B.n | ^^^ - | Access uninitialized field value n. Call trace: - | -> object B: [ return.scala:8 ] - | ^ - | -> val n = A.foo(-10)(20) [ return.scala:9 ] - | ^^^^^^^^^^^^^^ - | -> return (a: Int) => a + B.n [ return.scala:4 ] - | ^^^ + | Access uninitialized field value n. Calling trace: + | ├── object B: [ return.scala:8 ] + | │ ^ + | ├── val n = A.foo(-10)(20) [ return.scala:9 ] + | │ ^^^^^^^^^^^^^^ + | └── return (a: Int) => a + B.n [ return.scala:4 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/return2.check b/tests/init-global/neg/return2.check index 5f2f9fb3cbab..e0d9a6e33b14 100644 --- a/tests/init-global/neg/return2.check +++ b/tests/init-global/neg/return2.check @@ -1,13 +1,13 @@ -- Warning: tests/init-global/neg/return2.scala:3:30 ------------------------------------------------------------------- 3 | val f = (a: Int) => a + B.n | ^^^ - | Access uninitialized field value n. Call trace: - | -> object B: [ return2.scala:12 ] - | ^ - | -> val n = A.foo(-10)(20) [ return2.scala:13 ] - | ^^^^^^^^^^^^^^ - | -> val f = (a: Int) => a + B.n [ return2.scala:3 ] - | ^^^ + | Access uninitialized field value n. Calling trace: + | ├── object B: [ return2.scala:12 ] + | │ ^ + | ├── val n = A.foo(-10)(20) [ return2.scala:13 ] + | │ ^^^^^^^^^^^^^^ + | └── val f = (a: Int) => a + B.n [ return2.scala:3 ] + | ^^^ -- Warning: tests/init-global/neg/return2.scala:6:18 ------------------------------------------------------------------- 6 | val g = () => return f | ^^^^^^^^ diff --git a/tests/init-global/neg/t5366.check b/tests/init-global/neg/t5366.check index 01db17c85f8e..3aeda68fd96f 100644 --- a/tests/init-global/neg/t5366.check +++ b/tests/init-global/neg/t5366.check @@ -2,20 +2,20 @@ 3 |case object ObjA extends IdAndMsg(1) | ^ | Cyclic initialization: object ObjA -> object IdAndMsg -> object ObjA. Calling trace: - | -> case object ObjA extends IdAndMsg(1) [ t5366.scala:3 ] - | ^ - | -> object IdAndMsg { [ t5366.scala:6 ] - | ^ - | -> val values = List(ObjA , ObjB) [ t5366.scala:7 ] - | ^^^^ + | ├── case object ObjA extends IdAndMsg(1) [ t5366.scala:3 ] + | │ ^ + | ├── object IdAndMsg { [ t5366.scala:6 ] + | │ ^ + | └── val values = List(ObjA , ObjB) [ t5366.scala:7 ] + | ^^^^ -- Warning: tests/init-global/neg/t5366.scala:6:7 ---------------------------------------------------------------------- 6 |object IdAndMsg { | ^ | Cyclic initialization: object IdAndMsg -> object ObjB -> object IdAndMsg. Calling trace: - | -> object IdAndMsg { [ t5366.scala:6 ] - | ^ - | -> val values = List(ObjA , ObjB) [ t5366.scala:7 ] - | ^^^^ - | -> case object ObjB extends IdAndMsg(2) [ t5366.scala:4 ] - | ^ + | ├── object IdAndMsg { [ t5366.scala:6 ] + | │ ^ + | ├── val values = List(ObjA , ObjB) [ t5366.scala:7 ] + | │ ^^^^ + | └── case object ObjB extends IdAndMsg(2) [ t5366.scala:4 ] + | ^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/t9115.check b/tests/init-global/neg/t9115.check index bd90efaf526d..a55c2eb151a1 100644 --- a/tests/init-global/neg/t9115.check +++ b/tests/init-global/neg/t9115.check @@ -2,20 +2,20 @@ 4 | case object D1 extends Z(aaa) | ^ | Cyclic initialization: object D1 -> object D -> object D1. Calling trace: - | -> case object D1 extends Z(aaa) [ t9115.scala:4 ] - | ^^^ - | -> object D { [ t9115.scala:1 ] - | ^ - | -> println(D1) [ t9115.scala:6 ] - | ^^ + | ├── case object D1 extends Z(aaa) [ t9115.scala:4 ] + | │ ^^^ + | ├── object D { [ t9115.scala:1 ] + | │ ^ + | └── println(D1) [ t9115.scala:6 ] + | ^^ -- Warning: tests/init-global/neg/t9115.scala:1:7 ---------------------------------------------------------------------- 1 |object D { | ^ | Cyclic initialization: object D -> object D2 -> object D. Calling trace: - | -> object D { [ t9115.scala:1 ] - | ^ - | -> println(D2) [ t9115.scala:7 ] - | ^^ - | -> case object D2 extends Z(aaa) // 'null' when calling D.D2 first time [ t9115.scala:5 ] - | ^^^ + | ├── object D { [ t9115.scala:1 ] + | │ ^ + | ├── println(D2) [ t9115.scala:7 ] + | │ ^^ + | └── case object D2 extends Z(aaa) // 'null' when calling D.D2 first time [ t9115.scala:5 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/t9261.check b/tests/init-global/neg/t9261.check index 79dc40d0351c..dbda32347e74 100644 --- a/tests/init-global/neg/t9261.check +++ b/tests/init-global/neg/t9261.check @@ -2,8 +2,8 @@ 2 |case object Buy extends OrderType(Sell) | ^ | Cyclic initialization: object Buy -> object Sell -> object Buy. Calling trace: - | -> case object Buy extends OrderType(Sell) [ t9261.scala:2 ] - | ^^^^ - | -> case object Sell extends OrderType(Buy) [ t9261.scala:3 ] - | ^^^ + | ├── case object Buy extends OrderType(Sell) [ t9261.scala:2 ] + | │ ^^^^ + | └── case object Sell extends OrderType(Buy) [ t9261.scala:3 ] + | ^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/t9312.check b/tests/init-global/neg/t9312.check index 4a6e733dd148..d6f1b00b1a09 100644 --- a/tests/init-global/neg/t9312.check +++ b/tests/init-global/neg/t9312.check @@ -2,28 +2,28 @@ 18 | object Child1 extends Child | ^ | Cyclic initialization: object Child1 -> object Parent -> object Child1. Calling trace: - | -> object Child1 extends Child [ t9312.scala:18 ] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -> trait Child { [ t9312.scala:12 ] - | ^ - | -> val parent = Parent [ t9312.scala:14 ] - | ^^^^^^ - | -> object Parent { [ t9312.scala:11 ] - | ^ - | -> final val children = Set(Child1, Child2) [ t9312.scala:21 ] - | ^^^^^^ + | ├── object Child1 extends Child [ t9312.scala:18 ] + | │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ├── trait Child { [ t9312.scala:12 ] + | │ ^ + | ├── val parent = Parent [ t9312.scala:14 ] + | │ ^^^^^^ + | ├── object Parent { [ t9312.scala:11 ] + | │ ^ + | └── final val children = Set(Child1, Child2) [ t9312.scala:21 ] + | ^^^^^^ -- Warning: tests/init-global/neg/t9312.scala:11:9 --------------------------------------------------------------------- 11 | object Parent { | ^ | Cyclic initialization: object Parent -> object Child2 -> object Parent. Calling trace: - | -> object Parent { [ t9312.scala:11 ] - | ^ - | -> final val children = Set(Child1, Child2) [ t9312.scala:21 ] - | ^^^^^^ - | -> object Child2 extends Child [ t9312.scala:19 ] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -> trait Child { [ t9312.scala:12 ] - | ^ - | -> val parent = Parent [ t9312.scala:14 ] - | ^^^^^^ + | ├── object Parent { [ t9312.scala:11 ] + | │ ^ + | ├── final val children = Set(Child1, Child2) [ t9312.scala:21 ] + | │ ^^^^^^ + | ├── object Child2 extends Child [ t9312.scala:19 ] + | │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ├── trait Child { [ t9312.scala:12 ] + | │ ^ + | └── val parent = Parent [ t9312.scala:14 ] + | ^^^^^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/t9360.check b/tests/init-global/neg/t9360.check index e27ea4d5d26b..23ceea224a10 100644 --- a/tests/init-global/neg/t9360.check +++ b/tests/init-global/neg/t9360.check @@ -2,20 +2,20 @@ 8 | object AObj extends BaseClass(s) | ^ | Cyclic initialization: object AObj -> object Obj -> object AObj. Calling trace: - | -> object AObj extends BaseClass(s) [ t9360.scala:8 ] - | ^ - | -> object Obj { [ t9360.scala:5 ] - | ^ - | -> val list = List(AObj, BObj) [ t9360.scala:12 ] - | ^^^^ + | ├── object AObj extends BaseClass(s) [ t9360.scala:8 ] + | │ ^ + | ├── object Obj { [ t9360.scala:5 ] + | │ ^ + | └── val list = List(AObj, BObj) [ t9360.scala:12 ] + | ^^^^ -- Warning: tests/init-global/neg/t9360.scala:5:7 ---------------------------------------------------------------------- 5 |object Obj { | ^ | Cyclic initialization: object Obj -> object BObj -> object Obj. Calling trace: - | -> object Obj { [ t9360.scala:5 ] - | ^ - | -> val list = List(AObj, BObj) [ t9360.scala:12 ] - | ^^^^ - | -> object BObj extends BaseClass(s) [ t9360.scala:10 ] - | ^ + | ├── object Obj { [ t9360.scala:5 ] + | │ ^ + | ├── val list = List(AObj, BObj) [ t9360.scala:12 ] + | │ ^^^^ + | └── object BObj extends BaseClass(s) [ t9360.scala:10 ] + | ^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapply-implicit-arg.check b/tests/init-global/neg/unapply-implicit-arg.check index 8d4e1d9c9aa2..4e45d79e7e14 100644 --- a/tests/init-global/neg/unapply-implicit-arg.check +++ b/tests/init-global/neg/unapply-implicit-arg.check @@ -1,9 +1,9 @@ -- Warning: tests/init-global/neg/unapply-implicit-arg.scala:11:16 ----------------------------------------------------- 11 | val i2: Int = i2 match | ^^ - | Access uninitialized field value i2. Call trace: - | -> object Bar { [ unapply-implicit-arg.scala:1 ] - | ^ - | -> val i2: Int = i2 match [ unapply-implicit-arg.scala:11 ] - | ^^ + | Access uninitialized field value i2. Calling trace: + | ├── object Bar { [ unapply-implicit-arg.scala:1 ] + | │ ^ + | └── val i2: Int = i2 match [ unapply-implicit-arg.scala:11 ] + | ^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapply-implicit-arg2.check b/tests/init-global/neg/unapply-implicit-arg2.check index 3d045e1b92a7..ec317d59f1bd 100644 --- a/tests/init-global/neg/unapply-implicit-arg2.check +++ b/tests/init-global/neg/unapply-implicit-arg2.check @@ -1,13 +1,13 @@ -- Warning: tests/init-global/neg/unapply-implicit-arg2.scala:7:51 ----------------------------------------------------- 7 | if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) | ^^ - | Access uninitialized field value i2. Call trace: - | -> object Bar { [ unapply-implicit-arg2.scala:1 ] - | ^ - | -> case Bar(i) => i [ unapply-implicit-arg2.scala:12 ] - | ^^^^^^ - | -> def unapply(using f1: Foo)(i: Int): Option[Int] = [ unapply-implicit-arg2.scala:6 ] - | ^ - | -> if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) [ unapply-implicit-arg2.scala:7 ] + | Access uninitialized field value i2. Calling trace: + | ├── object Bar { [ unapply-implicit-arg2.scala:1 ] + | │ ^ + | ├── case Bar(i) => i [ unapply-implicit-arg2.scala:12 ] + | │ ^^^^^^ + | ├── def unapply(using f1: Foo)(i: Int): Option[Int] = [ unapply-implicit-arg2.scala:6 ] + | │ ^ + | └── if i == 0 then Some(f1.m1(i1)) else Some(f1.m2(i2)) [ unapply-implicit-arg2.scala:7 ] | ^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapply-implicit-arg3.check b/tests/init-global/neg/unapply-implicit-arg3.check index f402063704ff..3bb9c0ad2930 100644 --- a/tests/init-global/neg/unapply-implicit-arg3.check +++ b/tests/init-global/neg/unapply-implicit-arg3.check @@ -1,15 +1,15 @@ -- Warning: tests/init-global/neg/unapply-implicit-arg3.scala:4:25 ----------------------------------------------------- 4 | def m2(i: Int) = i + i2 | ^^ - | Access uninitialized field value i2. Call trace: - | -> object Bar { [ unapply-implicit-arg3.scala:1 ] - | ^ - | -> case Bar(i) => i [ unapply-implicit-arg3.scala:12 ] - | ^^^^^^ - | -> def unapply(using f1: Foo)(i: Int): Option[Int] = [ unapply-implicit-arg3.scala:6 ] - | ^ - | -> if i == 0 then Some(f1.m1(i)) else Some(f1.m2(i)) [ unapply-implicit-arg3.scala:7 ] - | ^^^^^^^^ - | -> def m2(i: Int) = i + i2 [ unapply-implicit-arg3.scala:4 ] - | ^^ + | Access uninitialized field value i2. Calling trace: + | ├── object Bar { [ unapply-implicit-arg3.scala:1 ] + | │ ^ + | ├── case Bar(i) => i [ unapply-implicit-arg3.scala:12 ] + | │ ^^^^^^ + | ├── def unapply(using f1: Foo)(i: Int): Option[Int] = [ unapply-implicit-arg3.scala:6 ] + | │ ^ + | ├── if i == 0 then Some(f1.m1(i)) else Some(f1.m2(i)) [ unapply-implicit-arg3.scala:7 ] + | │ ^^^^^^^^ + | └── def m2(i: Int) = i + i2 [ unapply-implicit-arg3.scala:4 ] + | ^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapplySeq-implicit-arg.check b/tests/init-global/neg/unapplySeq-implicit-arg.check index 869d0b38f2f6..d021cd1f5d94 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg.check +++ b/tests/init-global/neg/unapplySeq-implicit-arg.check @@ -1,9 +1,9 @@ -- Warning: tests/init-global/neg/unapplySeq-implicit-arg.scala:11:20 -------------------------------------------------- 11 | val i2: Int = Seq(i2) match | ^^ - | Access uninitialized field value i2. Call trace: - | -> object Bar { [ unapplySeq-implicit-arg.scala:1 ] - | ^ - | -> val i2: Int = Seq(i2) match [ unapplySeq-implicit-arg.scala:11 ] - | ^^ + | Access uninitialized field value i2. Calling trace: + | ├── object Bar { [ unapplySeq-implicit-arg.scala:1 ] + | │ ^ + | └── val i2: Int = Seq(i2) match [ unapplySeq-implicit-arg.scala:11 ] + | ^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapplySeq-implicit-arg2.check b/tests/init-global/neg/unapplySeq-implicit-arg2.check index bda9e4266f3c..2e5164d7b405 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg2.check +++ b/tests/init-global/neg/unapplySeq-implicit-arg2.check @@ -1,13 +1,13 @@ -- Warning: tests/init-global/neg/unapplySeq-implicit-arg2.scala:4:9 --------------------------------------------------- 4 | Some(i1 +: seqi) | ^^ - |Access uninitialized field value i1. Call trace: - |-> object Bar { [ unapplySeq-implicit-arg2.scala:1 ] - | ^ - |-> case Bar(i) => i [ unapplySeq-implicit-arg2.scala:7 ] - | ^^^^^^ - |-> def unapplySeq(using f1: Foo)(using f2: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = [ unapplySeq-implicit-arg2.scala:3 ] - | ^ - |-> Some(i1 +: seqi) [ unapplySeq-implicit-arg2.scala:4 ] - | ^^ + |Access uninitialized field value i1. Calling trace: + |├── object Bar { [ unapplySeq-implicit-arg2.scala:1 ] + |│ ^ + |├── case Bar(i) => i [ unapplySeq-implicit-arg2.scala:7 ] + |│ ^^^^^^ + |├── def unapplySeq(using f1: Foo)(using f2: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = [ unapplySeq-implicit-arg2.scala:3 ] + |│ ^ + |└── Some(i1 +: seqi) [ unapplySeq-implicit-arg2.scala:4 ] + | ^^ No warnings can be incurred under -Werror. diff --git a/tests/init-global/neg/unapplySeq-implicit-arg3.check b/tests/init-global/neg/unapplySeq-implicit-arg3.check index abf11f0bafec..59ea56320452 100644 --- a/tests/init-global/neg/unapplySeq-implicit-arg3.check +++ b/tests/init-global/neg/unapplySeq-implicit-arg3.check @@ -1,15 +1,15 @@ -- Warning: tests/init-global/neg/unapplySeq-implicit-arg3.scala:3:27 -------------------------------------------------- 3 | def m(seq: Seq[Int]) = i1 +: seq | ^^ - |Access uninitialized field value i1. Call trace: - |-> object Bar { [ unapplySeq-implicit-arg3.scala:1 ] - | ^ - |-> case Bar(i, _) => i [ unapplySeq-implicit-arg3.scala:9 ] - | ^^^^^^^^^ - |-> def unapplySeq(using f1: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = [ unapplySeq-implicit-arg3.scala:5 ] - | ^ - |-> Some(f1.m(seqi)) [ unapplySeq-implicit-arg3.scala:6 ] - | ^^^^^^^^^^ - |-> def m(seq: Seq[Int]) = i1 +: seq [ unapplySeq-implicit-arg3.scala:3 ] - | ^^ + |Access uninitialized field value i1. Calling trace: + |├── object Bar { [ unapplySeq-implicit-arg3.scala:1 ] + |│ ^ + |├── case Bar(i, _) => i [ unapplySeq-implicit-arg3.scala:9 ] + |│ ^^^^^^^^^ + |├── def unapplySeq(using f1: Foo)(seqi: Seq[Int])(using Foo): Option[Seq[Int]] = [ unapplySeq-implicit-arg3.scala:5 ] + |│ ^ + |├── Some(f1.m(seqi)) [ unapplySeq-implicit-arg3.scala:6 ] + |│ ^^^^^^^^^^ + |└── def m(seq: Seq[Int]) = i1 +: seq [ unapplySeq-implicit-arg3.scala:3 ] + | ^^ No warnings can be incurred under -Werror. 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/init/neg/secondary-ctor4.check b/tests/init/warn/secondary-ctor4.check similarity index 84% rename from tests/init/neg/secondary-ctor4.check rename to tests/init/warn/secondary-ctor4.check index 2c89cfe9f289..3909af5ac336 100644 --- a/tests/init/neg/secondary-ctor4.check +++ b/tests/init/warn/secondary-ctor4.check @@ -1,10 +1,10 @@ --- Error: tests/init/neg/secondary-ctor4.scala:54:14 ------------------------------------------------------------------- -54 | val c = new C(b, 5) // error +-- Warning: tests/init/warn/secondary-ctor4.scala:54:14 ---------------------------------------------------------------- +54 | val c = new C(b, 5) // warn | ^^^^^^^^^^^ | Problematic object instantiation: arg 1 is not transitively initialized (Hot). Calling trace: | ├── class D { [ secondary-ctor4.scala:52 ] | │ ^ - | └── val c = new C(b, 5) // error [ secondary-ctor4.scala:54 ] + | └── val c = new C(b, 5) // warn [ secondary-ctor4.scala:54 ] | ^^^^^^^^^^^ | | It leads to the following error during object initialization: @@ -21,15 +21,15 @@ | │ ^ | └── println(b.n) [ secondary-ctor4.scala:23 ] | ^^^ --- Error: tests/init/neg/secondary-ctor4.scala:42:4 -------------------------------------------------------------------- -42 | new A(new B(new D)) // error +-- Warning: tests/init/warn/secondary-ctor4.scala:42:4 ----------------------------------------------------------------- +42 | new A(new B(new D)) // warn | ^^^^^^^^^^^^^^^^^^^ |Problematic object instantiation: the outer M.this and arg 1 are not transitively initialized (Hot). Calling trace: |├── class N(d: D) extends M(d) { [ secondary-ctor4.scala:59 ] |│ ^ |├── def this(d: D) = { [ secondary-ctor4.scala:7 ] |│ ^ - |└── new A(new B(new D)) // error [ secondary-ctor4.scala:42 ] + |└── new A(new B(new D)) // warn [ secondary-ctor4.scala:42 ] | ^^^^^^^^^^^^^^^^^^^ | |It leads to the following error during object initialization: diff --git a/tests/init/neg/secondary-ctor4.scala b/tests/init/warn/secondary-ctor4.scala similarity index 90% rename from tests/init/neg/secondary-ctor4.scala rename to tests/init/warn/secondary-ctor4.scala index e80630002638..9c53034ee597 100644 --- a/tests/init/neg/secondary-ctor4.scala +++ b/tests/init/warn/secondary-ctor4.scala @@ -10,7 +10,7 @@ class M(x: Int) { class L1(x: Int) { val n: Int = 5 } class A(b: B, x: Int) { - println(d.n) + println(d.n) class L2(x: Int) { val n: Int = 5 } @@ -39,7 +39,7 @@ class M(x: Int) { val n: Int = 10 } - new A(new B(new D)) // error + new A(new B(new D)) // warn trait T { val m: Int = 10 @@ -51,7 +51,7 @@ class M(x: Int) { class D { val b = new B(this) - val c = new C(b, 5) // error + val c = new C(b, 5) // warn } } } diff --git a/tests/init/neg/trait1.scala b/tests/init/warn/trait1.scala similarity index 79% rename from tests/init/neg/trait1.scala rename to tests/init/warn/trait1.scala index 48eae248fee7..d5c30569c4ee 100644 --- a/tests/init/neg/trait1.scala +++ b/tests/init/warn/trait1.scala @@ -3,7 +3,7 @@ abstract class A(x: Int) { foo() } -trait B(val y: Int) // error +trait B(val y: Int) // warn class C extends A(10) with B(20) { def foo(): Unit = println(y) diff --git a/tests/init/neg/trait2.scala b/tests/init/warn/trait2.scala similarity index 83% rename from tests/init/neg/trait2.scala rename to tests/init/warn/trait2.scala index 6011c259b73f..1b5bfded5730 100644 --- a/tests/init/neg/trait2.scala +++ b/tests/init/warn/trait2.scala @@ -3,7 +3,7 @@ abstract class A(x: Int) { foo() } -trait B(val y: Int) // error +trait B(val y: Int) // warn class D { class C extends A(10) with B(20) { 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/filtering-fors.scala b/tests/neg/filtering-fors.scala index ef6d7790ce7e..7d998a37f057 100644 --- a/tests/neg/filtering-fors.scala +++ b/tests/neg/filtering-fors.scala @@ -8,18 +8,18 @@ object Test { for (x: Any <- xs) do () // OK for (x: String <- xs) do () // error - for ((x: String) <- xs) do () // warn - for (y@ (x: String) <- xs) do () // warn - for ((x, y) <- xs) do () // warn + for ((x: String) <- xs) do () // error + for (y@ (x: String) <- xs) do () // error + for ((x, y) <- xs) do () // error - for ((x: String) <- xs if x.isEmpty) do () // warn - for ((x: String) <- xs; y = x) do () // warn - for ((x: String) <- xs; (y, z) <- xs) do () // warn // warn - for (case (x: String) <- xs; (y, z) <- xs) do () // warn - for ((x: String) <- xs; case (y, z) <- xs) do () // warn + for ((x: String) <- xs if x.isEmpty) do () // error + for ((x: String) <- xs; y = x) do () // error + for ((x: String) <- xs; (y, z) <- xs) do () // error // error + for (case (x: String) <- xs; (y, z) <- xs) do () // error + for ((x: String) <- xs; case (y, z) <- xs) do () // error val pairs: List[AnyRef] = List((1, 2), "hello", (3, 4)) - for ((x, y) <- pairs) yield (y, x) // warn + for ((x, y) <- pairs) yield (y, x) // error for (case x: String <- xs) do () // OK for (case (x: String) <- xs) do () // OK @@ -31,5 +31,4 @@ object Test { for (case (x: String) <- xs; case (y, z) <- xs) do () // OK for (case (x, y) <- pairs) yield (y, x) // OK -} -// 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/i11225b.check b/tests/neg/i11225b.check new file mode 100644 index 000000000000..12ec80515e6f --- /dev/null +++ b/tests/neg/i11225b.check @@ -0,0 +1,6 @@ +-- Error: tests/neg/i11225b.scala:6:26 --------------------------------------------------------------------------------- +6 | private var cached: A = _ // error + | ^ + | `= _` has been deprecated; use `= uninitialized` instead. + | `uninitialized` can be imported with `scala.compiletime.uninitialized`. + | This construct can be rewritten automatically under -rewrite -source 3.4-migration. diff --git a/tests/warn/i11225b.scala b/tests/neg/i11225b.scala similarity index 68% rename from tests/warn/i11225b.scala rename to tests/neg/i11225b.scala index ad4e747fdc86..c2b94571e06c 100644 --- a/tests/warn/i11225b.scala +++ b/tests/neg/i11225b.scala @@ -1,9 +1,9 @@ -//> using options -source future -deprecation +//> using options -source future -deprecation import compiletime.uninitialized class Memo[A](x: => A): - private var cached: A = _ // warn + private var cached: A = _ // error private var known: Boolean = false def force = if !known then diff --git a/tests/neg/i18862-3.4.scala b/tests/neg/i18862-3.4.scala deleted file mode 100644 index a30c8c8f1a59..000000000000 --- a/tests/neg/i18862-3.4.scala +++ /dev/null @@ -1,6 +0,0 @@ -//> using options -Werror - -import scala.language.`3.4` - -def f(x: Int*): Unit = () -def test(xs: List[Int]): Unit = f(xs: _*) // error: migration warning diff --git a/tests/neg/i18862-future-migration.scala b/tests/neg/i18862-future-migration.scala deleted file mode 100644 index ff8ba1c377c3..000000000000 --- a/tests/neg/i18862-future-migration.scala +++ /dev/null @@ -1,6 +0,0 @@ -//> using options -Werror - -import scala.language.`future-migration` - -def f(x: Int*): Unit = () -def test(xs: List[Int]): Unit = f(xs: _*) // error: migration warning diff --git a/tests/neg/i18867-3.4.scala b/tests/neg/i18867-3.4.scala deleted file mode 100644 index c5fd2976c8b0..000000000000 --- a/tests/neg/i18867-3.4.scala +++ /dev/null @@ -1,7 +0,0 @@ -//> using options -Werror - -import language.`3.4` - -def foo(x: Int) = x - -def test = foo _ // error diff --git a/tests/neg/i18867.scala b/tests/neg/i18867.scala deleted file mode 100644 index 722347a613f5..000000000000 --- a/tests/neg/i18867.scala +++ /dev/null @@ -1,5 +0,0 @@ -//> using options -Werror - -def foo(x: Int) = x - -def test = foo _ // error diff --git a/tests/neg/infix.check b/tests/neg/infix.check new file mode 100644 index 000000000000..7c7c87005291 --- /dev/null +++ b/tests/neg/infix.check @@ -0,0 +1,30 @@ +-- Error: tests/neg/infix.scala:26:4 ----------------------------------------------------------------------------------- +26 | c mop 2 // error: should not be used as infix operator + | ^^^ + | Alphanumeric method mop is not declared infix; it should not be used as infix operator. + | Instead, use method syntax .mop(...) or backticked identifier `mop`. + | The latter can be rewritten automatically under -rewrite -source future-migration. +-- Error: tests/neg/infix.scala:27:4 ----------------------------------------------------------------------------------- +27 | c meth 2 // error: should not be used as infix operator + | ^^^^ + | Alphanumeric method meth is not declared infix; it should not be used as infix operator. + | Instead, use method syntax .meth(...) or backticked identifier `meth`. + | The latter can be rewritten automatically under -rewrite -source future-migration. +-- Error: tests/neg/infix.scala:45:14 ---------------------------------------------------------------------------------- +45 | val x1: Int Map String = ??? // error + | ^^^ + | Alphanumeric type Map is not declared infix; it should not be used as infix operator. + | Instead, use prefix syntax Map[...] or backticked identifier `Map`. + | The latter can be rewritten automatically under -rewrite -source future-migration. +-- Error: tests/neg/infix.scala:47:14 ---------------------------------------------------------------------------------- +47 | val x3: Int AndC String = ??? // error + | ^^^^ + | Alphanumeric type AndC is not declared infix; it should not be used as infix operator. + | Instead, use prefix syntax AndC[...] or backticked identifier `AndC`. + | The latter can be rewritten automatically under -rewrite -source future-migration. +-- Error: tests/neg/infix.scala:61:8 ----------------------------------------------------------------------------------- +61 | val _ Pair _ = p // error + | ^^^^ + | Alphanumeric extractor Pair is not declared infix; it should not be used as infix operator. + | Instead, use prefix syntax Pair(...) or backticked identifier `Pair`. + | The latter can be rewritten automatically under -rewrite -source future-migration. diff --git a/tests/warn/infix.scala b/tests/neg/infix.scala similarity index 82% rename from tests/warn/infix.scala rename to tests/neg/infix.scala index 6494df970e3f..dda638c829f9 100644 --- a/tests/warn/infix.scala +++ b/tests/neg/infix.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation +//> using options -source future -deprecation // Compile with -strict -Xfatal-warnings -deprecation class C: @@ -23,8 +23,8 @@ def test() = { c.op(2) c.iop(2) - c mop 2 // warn: should not be used as infix operator - c meth 2 // warn: should not be used as infix operator + c mop 2 // error: should not be used as infix operator + c meth 2 // error: should not be used as infix operator c `meth` 2 // OK, sincd `meth` is backquoted c + 3 // OK, since `+` is symbolic 1 to 2 // OK, since `to` is defined by Scala-2 @@ -42,9 +42,9 @@ def test() = { class Map[X, Y] - val x1: Int Map String = ??? // warn + val x1: Int Map String = ??? // error val x2: Int Or String = ??? // OK since Or is declared `infix` - val x3: Int AndC String = ??? // warn + val x3: Int AndC String = ??? // error val x4: Int `AndC` String = ??? // OK val x5: Int And String = ??? // OK val x6: Int && String = ??? @@ -58,7 +58,7 @@ def test() = { val p = Pair(1, 2) val Pair(_, _) = p - val _ Pair _ = p // warn + val _ Pair _ = p // error val _ `Pair` _ = p // OK val (_ PP _) = p: @unchecked // OK diff --git a/tests/neg/private-this-3.4.scala b/tests/neg/private-this-3.4.scala deleted file mode 100644 index b198e954e41b..000000000000 --- a/tests/neg/private-this-3.4.scala +++ /dev/null @@ -1,7 +0,0 @@ -//> using options -Werror - -import scala.language.`3.4` - -class Foo: - private[this] def foo: Int = ??? // error: migration warning - protected[this] def bar: Int = ??? // error: migration warning diff --git a/tests/neg/private-this-future-migration.scala b/tests/neg/private-this-future-migration.scala deleted file mode 100644 index 7e3da2be72e2..000000000000 --- a/tests/neg/private-this-future-migration.scala +++ /dev/null @@ -1,7 +0,0 @@ -//> using options -Werror - -import scala.language.`future-migration` - -class Foo: - private[this] def foo: Int = ??? // error: migration warning - protected[this] def bar: Int = ??? // error: migration warning diff --git a/tests/warn/refutable-pattern-binding-messages.check b/tests/neg/refutable-pattern-binding-messages.check similarity index 65% rename from tests/warn/refutable-pattern-binding-messages.check rename to tests/neg/refutable-pattern-binding-messages.check index f3c3adb7835e..4a8f895264a3 100644 --- a/tests/warn/refutable-pattern-binding-messages.check +++ b/tests/neg/refutable-pattern-binding-messages.check @@ -1,19 +1,12 @@ --- Warning: tests/warn/refutable-pattern-binding-messages.scala:5:14 --------------------------------------------------- -5 | val Positive(p) = 5 // warn: 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. --- Warning: tests/warn/refutable-pattern-binding-messages.scala:6:14 --------------------------------------------------- -6 | for Positive(i) <- List(1, 2, 3) do () // warn: refutable extractor +-- Error: tests/neg/refutable-pattern-binding-messages.scala:6:14 ------------------------------------------------------ +6 | for Positive(i) <- List(1, 2, 3) do () // error: refutable extractor | ^^^^^^^^^^^ | pattern binding uses refutable extractor `Test.Positive` | | 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:11:11 ----------------------------------------------------- 11 | for ((x: String) <- xs) do () // error: pattern type more specialized | ^^^^^^ | pattern's type String is more specialized than the right hand side expression's type AnyRef @@ -21,32 +14,32 @@ | 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. --- Warning: tests/warn/refutable-pattern-binding-messages.scala:15:13 -------------------------------------------------- -15 | for none @ None <- ys do () // warn: pattern type does not match +-- Error: tests/neg/refutable-pattern-binding-messages.scala:15:13 ----------------------------------------------------- +15 | for none @ None <- ys do () // error: pattern type does not match | ^^^^ | pattern's type None.type does not match the right hand side expression's type (x$1 : Option[?]) | | 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 +-- Warning: tests/neg/refutable-pattern-binding-messages.scala:5:14 ---------------------------------------------------- +5 | val Positive(p) = 5 // warn: 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 +-- Warning: tests/neg/refutable-pattern-binding-messages.scala:10:20 --------------------------------------------------- +10 | val i :: is = List(1, 2, 3) // warn: 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 +-- Warning: tests/neg/refutable-pattern-binding-messages.scala:16:10 --------------------------------------------------- +16 | val 1 = 2 // warn: pattern type does not match | ^ | pattern's type (1 : Int) does not match the right hand side expression's type (2 : Int) | diff --git a/tests/warn/refutable-pattern-binding-messages.scala b/tests/neg/refutable-pattern-binding-messages.scala similarity index 65% rename from tests/warn/refutable-pattern-binding-messages.scala rename to tests/neg/refutable-pattern-binding-messages.scala index 41aa24787389..e71371785d15 100644 --- a/tests/warn/refutable-pattern-binding-messages.scala +++ b/tests/neg/refutable-pattern-binding-messages.scala @@ -3,15 +3,15 @@ object Test { // refutable extractor object Positive { def unapply(i: Int): Option[Int] = Some(i).filter(_ > 0) } val Positive(p) = 5 // warn: refutable extractor - for Positive(i) <- List(1, 2, 3) do () // warn: refutable extractor + for Positive(i) <- List(1, 2, 3) do () // error: refutable extractor // more specialized val xs: List[AnyRef] = ??? val i :: is = List(1, 2, 3) // warn: pattern type more specialized - for ((x: String) <- xs) do () // warn: pattern type more specialized + for ((x: String) <- xs) do () // error: pattern type more specialized // does not match val ys: List[Option[?]] = ??? - for none @ None <- ys do () // warn: pattern type does not match + for none @ None <- ys do () // error: pattern type does not match val 1 = 2 // warn: pattern type does not match -} \ No newline at end of file +} diff --git a/tests/neg/i18862-3.4.check b/tests/warn/i18862-3.4.check similarity index 70% rename from tests/neg/i18862-3.4.check rename to tests/warn/i18862-3.4.check index b56454feeeaa..8dd5058d305e 100644 --- a/tests/neg/i18862-3.4.check +++ b/tests/warn/i18862-3.4.check @@ -1,5 +1,5 @@ --- Error: tests/neg/i18862-3.4.scala:6:38 ------------------------------------------------------------------------------ -6 |def test(xs: List[Int]): Unit = f(xs: _*) // error: migration warning +-- Warning: tests/warn/i18862-3.4.scala:4:38 --------------------------------------------------------------------------- +4 |def test(xs: List[Int]): Unit = f(xs: _*) // warn: migration warning | ^ | The syntax `x: _*` is no longer supported for vararg splices; use `x*` instead | This construct can be rewritten automatically under -rewrite -source 3.4-migration. diff --git a/tests/warn/i18862-3.4.scala b/tests/warn/i18862-3.4.scala new file mode 100644 index 000000000000..6d9cf8c71f7b --- /dev/null +++ b/tests/warn/i18862-3.4.scala @@ -0,0 +1,4 @@ +import scala.language.`3.4` + +def f(x: Int*): Unit = () +def test(xs: List[Int]): Unit = f(xs: _*) // warn: migration warning diff --git a/tests/warn/i18862-future-migration.scala b/tests/warn/i18862-future-migration.scala new file mode 100644 index 000000000000..02225b67435a --- /dev/null +++ b/tests/warn/i18862-future-migration.scala @@ -0,0 +1,4 @@ +import scala.language.`future-migration` + +def f(x: Int*): Unit = () +def test(xs: List[Int]): Unit = f(xs: _*) // warn: migration warning diff --git a/tests/warn/i18867-3.4.scala b/tests/warn/i18867-3.4.scala new file mode 100644 index 000000000000..e2630c0cb95c --- /dev/null +++ b/tests/warn/i18867-3.4.scala @@ -0,0 +1,5 @@ +import language.`3.4` + +def foo(x: Int) = x + +def test = foo _ // warn diff --git a/tests/neg/i18867.check b/tests/warn/i18867.check similarity index 76% rename from tests/neg/i18867.check rename to tests/warn/i18867.check index 014e9e7bd92e..226496d8e74b 100644 --- a/tests/neg/i18867.check +++ b/tests/warn/i18867.check @@ -1,5 +1,5 @@ --- Error: tests/neg/i18867.scala:5:15 ---------------------------------------------------------------------------------- -5 |def test = foo _ // error +-- Warning: tests/warn/i18867.scala:3:15 ------------------------------------------------------------------------------- +3 |def test = foo _ // warn | ^^^^^ | The syntax ` _` is no longer supported; | you can simply leave out the trailing ` _` diff --git a/tests/warn/i18867.scala b/tests/warn/i18867.scala new file mode 100644 index 000000000000..a16d67b89919 --- /dev/null +++ b/tests/warn/i18867.scala @@ -0,0 +1,3 @@ +def foo(x: Int) = x + +def test = foo _ // warn diff --git a/tests/neg/private-this-3.4.check b/tests/warn/private-this-3.4.check similarity index 74% rename from tests/neg/private-this-3.4.check rename to tests/warn/private-this-3.4.check index 29c2fe909ede..29cdcfac6477 100644 --- a/tests/neg/private-this-3.4.check +++ b/tests/warn/private-this-3.4.check @@ -1,11 +1,11 @@ --- Error: tests/neg/private-this-3.4.scala:6:16 ------------------------------------------------------------------------ -6 | private[this] def foo: Int = ??? // error: migration warning +-- Warning: tests/warn/private-this-3.4.scala:4:16 --------------------------------------------------------------------- +4 | private[this] def foo: Int = ??? // warn: migration warning | ^ | The [this] qualifier will be deprecated in the future; it should be dropped. | See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html | This construct can be rewritten automatically under -rewrite -source 3.4-migration. --- Error: tests/neg/private-this-3.4.scala:7:18 ------------------------------------------------------------------------ -7 | protected[this] def bar: Int = ??? // error: migration warning +-- Warning: tests/warn/private-this-3.4.scala:5:18 --------------------------------------------------------------------- +5 | protected[this] def bar: Int = ??? // warn: migration warning | ^ | The [this] qualifier will be deprecated in the future; it should be dropped. | See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html diff --git a/tests/warn/private-this-3.4.scala b/tests/warn/private-this-3.4.scala new file mode 100644 index 000000000000..1270eba116bc --- /dev/null +++ b/tests/warn/private-this-3.4.scala @@ -0,0 +1,5 @@ +import scala.language.`3.4` + +class Foo: + private[this] def foo: Int = ??? // warn: migration warning + protected[this] def bar: Int = ??? // warn: migration warning diff --git a/tests/warn/private-this-future-migration.scala b/tests/warn/private-this-future-migration.scala new file mode 100644 index 000000000000..d719187e534a --- /dev/null +++ b/tests/warn/private-this-future-migration.scala @@ -0,0 +1,5 @@ +import scala.language.`future-migration` + +class Foo: + private[this] def foo: Int = ??? // warn: migration warning + protected[this] def bar: Int = ??? // warn: migration warning diff --git a/tests/warn/rewrite-messages.check b/tests/warn/rewrite-messages.check index f982e35cfdd9..db97d2ed908a 100644 --- a/tests/warn/rewrite-messages.check +++ b/tests/warn/rewrite-messages.check @@ -3,7 +3,7 @@ | ^ | `_` is no longer supported for a wildcard import; use `*` instead | This construct can be rewritten automatically under -rewrite -source future-migration. --- Deprecation Warning: tests/warn/rewrite-messages.scala:7:4 ---------------------------------------------------------- +-- Migration Warning: tests/warn/rewrite-messages.scala:7:4 ------------------------------------------------------------ 7 | 2 foo 4 // warn | ^^^ | Alphanumeric method foo is not declared infix; it should not be used as infix operator. diff --git a/tests/neg/uninitialized-3.4.check b/tests/warn/uninitialized-3.4.check similarity index 75% rename from tests/neg/uninitialized-3.4.check rename to tests/warn/uninitialized-3.4.check index 1c7b985072d0..ddf4bfed85ed 100644 --- a/tests/neg/uninitialized-3.4.check +++ b/tests/warn/uninitialized-3.4.check @@ -1,5 +1,5 @@ --- Error: tests/neg/uninitialized-3.4.scala:7:15 ----------------------------------------------------------------------- -7 | var a: Int = _ // error: migration warning +-- Warning: tests/warn/uninitialized-3.4.scala:5:15 -------------------------------------------------------------------- +5 | var a: Int = _ // warn | ^ | `= _` has been deprecated; use `= uninitialized` instead. | `uninitialized` can be imported with `scala.compiletime.uninitialized`. diff --git a/tests/neg/uninitialized-3.4.scala b/tests/warn/uninitialized-3.4.scala similarity index 60% rename from tests/neg/uninitialized-3.4.scala rename to tests/warn/uninitialized-3.4.scala index 174a95ae6c54..966f2e51af1c 100644 --- a/tests/neg/uninitialized-3.4.scala +++ b/tests/warn/uninitialized-3.4.scala @@ -1,8 +1,6 @@ -//> using options -Werror - import scala.language.`3.4` import scala.compiletime.uninitialized class Foo: - var a: Int = _ // error: migration warning + var a: Int = _ // warn var b: Int = uninitialized diff --git a/tests/neg/uninitialized-future-migration.scala b/tests/warn/uninitialized-future-migration.scala similarity index 62% rename from tests/neg/uninitialized-future-migration.scala rename to tests/warn/uninitialized-future-migration.scala index 05f7c6b67f38..7c24f2466221 100644 --- a/tests/neg/uninitialized-future-migration.scala +++ b/tests/warn/uninitialized-future-migration.scala @@ -1,8 +1,6 @@ -//> using options -Werror - import scala.language.`future-migration` import scala.compiletime.uninitialized class Foo: - var a: Int = _ // error: migration warning + var a: Int = _ // warn: migration warning var b: Int = uninitialized diff --git a/tests/neg/wildcard-type-syntax-3.4.scala b/tests/warn/wildcard-type-syntax-3.4.scala similarity index 52% rename from tests/neg/wildcard-type-syntax-3.4.scala rename to tests/warn/wildcard-type-syntax-3.4.scala index 1123c9cbbe35..2dd280259ac5 100644 --- a/tests/neg/wildcard-type-syntax-3.4.scala +++ b/tests/warn/wildcard-type-syntax-3.4.scala @@ -1,8 +1,6 @@ -//> using options -Werror - import scala.language.`3.4-migration` def test = Seq() match - case _: List[_] => // error: migration warning + case _: List[_] => // warn: migration warning case _: Seq[?] => diff --git a/tests/neg/wildcard-type-syntax-future-migration.scala b/tests/warn/wildcard-type-syntax-future-migration.scala similarity index 53% rename from tests/neg/wildcard-type-syntax-future-migration.scala rename to tests/warn/wildcard-type-syntax-future-migration.scala index 6a5367385ab0..1c55827adb90 100644 --- a/tests/neg/wildcard-type-syntax-future-migration.scala +++ b/tests/warn/wildcard-type-syntax-future-migration.scala @@ -1,8 +1,6 @@ -//> using options -Werror - import scala.language.`future-migration` def test = Seq() match - case _: List[_] => // error: migration warning + case _: List[_] => // warn: migration warning case _: Seq[?] => From 71a66c4d8b31f3c2189e5724c7cf31a20377a24a Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Mon, 20 Nov 2023 15:49:01 +0100 Subject: [PATCH 10/11] Fix checks outside of testCompilation --- compiler/test-resources/repl/rewrite-messages | 13 ++++++++----- tests/neg-macros/i9570.check | 5 +++++ tests/neg-macros/i9570.scala | 4 +++- tests/neg-macros/macro-deprecation.check | 5 +++++ tests/neg-macros/macro-deprecation.scala | 4 +++- tests/patmat/i14407.dupe.check | 1 + tests/patmat/i18118.check | 1 + 7 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 tests/neg-macros/i9570.check create mode 100644 tests/neg-macros/macro-deprecation.check diff --git a/compiler/test-resources/repl/rewrite-messages b/compiler/test-resources/repl/rewrite-messages index a63a72195019..393b87ee272b 100644 --- a/compiler/test-resources/repl/rewrite-messages +++ b/compiler/test-resources/repl/rewrite-messages @@ -1,17 +1,20 @@ //> using options -source:future-migration -deprecation -Werror scala> import scala.util._ --- Error: ---------------------------------------------------------------------- +-- Migration Warning: ---------------------------------------------------------- 1 | import scala.util._ | ^ | `_` is no longer supported for a wildcard import; use `*` instead - +No warnings can be incurred under -Werror. +1 warning found +1 error found scala> extension (x: Int) def foo(y: Int) = x + y def foo(x: Int)(y: Int): Int - scala> 2 foo 4 --- Error: ---------------------------------------------------------------------- +-- Migration Warning: ---------------------------------------------------------- 1 | 2 foo 4 | ^^^ |Alphanumeric method foo is not declared infix; it should not be used as infix operator. |Instead, use method syntax .foo(...) or backticked identifier `foo`. -1 error found +No warnings can be incurred under -Werror. +1 warning found +1 error found \ No newline at end of file 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..8afd76fc7181 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) } @@ -24,3 +24,5 @@ object Macros { } } + +// 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/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 From 91bc65a6123613c53c2b71ab798828502d26be53 Mon Sep 17 00:00:00 2001 From: Szymon Rodziewicz Date: Tue, 21 Nov 2023 17:53:36 +0100 Subject: [PATCH 11/11] Fix sjs tests --- tests/neg-scalajs/enumeration-warnings.check | 49 ++++++++++---------- tests/neg-scalajs/enumeration-warnings.scala | 26 ++++++----- 2 files changed, 39 insertions(+), 36 deletions(-) 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.