diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index e0ed71914ca4..3074d484ed50 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -42,30 +42,11 @@ class CompilationTests { compileFilesInDir("tests/new", defaultOptions.and("-source", "3.2")), // just to see whether 3.2 works compileFilesInDir("tests/pos-scala2", scala2CompatMode), compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")), - compileFilesInDir("tests/pos-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")), compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")), // Run tests for legacy lazy vals compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)), compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes), - compileFilesInDir("tests/pos-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")), - compileFilesInDir("tests/pos-custom-args/strict", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")), compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")), - compileFile( - // succeeds despite -Xfatal-warnings because of -nowarn - "tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala", - defaultOptions.and("-nowarn", "-Xfatal-warnings") - ), - compileFile("tests/pos-special/typeclass-scaling.scala", defaultOptions.and("-Xmax-inlines", "40")), - compileFile("tests/pos-special/i7575.scala", defaultOptions.andLanguageFeature("dynamics")), - compileFile("tests/pos-special/kind-projector.scala", defaultOptions.and("-Ykind-projector")), - compileFile("tests/pos-special/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")), - compileFile("tests/run/i5606.scala", defaultOptions.and("-Yretain-trees")), - compileFile("tests/pos-custom-args/i8875.scala", defaultOptions.and("-Xprint:getters")), - compileFile("tests/pos-custom-args/i9267.scala", defaultOptions.and("-Ystop-after:erasure")), - compileFile("tests/pos-special/extend-java-enum.scala", defaultOptions.and("-source", "3.0-migration")), - compileFile("tests/pos-custom-args/help.scala", defaultOptions.and("-help", "-V", "-W", "-X", "-Y")), - compileFile("tests/pos-custom-args/i13044.scala", defaultOptions.and("-Xmax-inlines:33")), - compileFile("tests/pos-custom-args/jdk-8-app.scala", defaultOptions.and("-release:8")) ) if scala.util.Properties.isJavaAtLeast("16") then @@ -141,29 +122,14 @@ class CompilationTests { compileFilesInDir("tests/neg", defaultOptions), compileFilesInDir("tests/neg-tailcall", defaultOptions), compileFilesInDir("tests/neg-strict", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")), - compileFilesInDir("tests/neg-no-kind-polymorphism", defaultOptions and "-Yno-kind-polymorphism"), - compileFilesInDir("tests/neg-custom-args/deprecation", defaultOptions.and("-Xfatal-warnings", "-deprecation")), - compileFilesInDir("tests/neg-custom-args/fatal-warnings", defaultOptions.and("-Xfatal-warnings")), - compileFilesInDir("tests/neg-custom-args/nowarn", defaultOptions.and("-deprecation", "-Wunused:nowarn", "-Wconf:msg=@nowarn annotation does not suppress any warnings:e")), - compileFilesInDir("tests/neg-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")), compileFilesInDir("tests/neg-custom-args/allow-double-bindings", allowDoubleBindings), compileFilesInDir("tests/neg-custom-args/allow-deep-subtypes", allowDeepSubtypes), - compileFilesInDir("tests/neg-custom-args/feature", defaultOptions.and("-Xfatal-warnings", "-feature")), - compileFilesInDir("tests/neg-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")), compileFilesInDir("tests/neg-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")), - compileFilesInDir("tests/neg-custom-args/explain", defaultOptions.and("-explain")), - compileFile("tests/neg-custom-args/avoid-warn-deprecation.scala", defaultOptions.and("-Xfatal-warnings", "-feature")), - compileFile("tests/neg-custom-args/i3246.scala", scala2CompatMode), - compileFile("tests/neg-custom-args/overrideClass.scala", scala2CompatMode), - compileFile("tests/neg-custom-args/ovlazy.scala", scala2CompatMode.and("-Xfatal-warnings")), - compileFile("tests/neg-custom-args/newline-braces.scala", scala2CompatMode.and("-Xfatal-warnings")), - compileFile("tests/neg-custom-args/autoTuplingTest.scala", defaultOptions.andLanguageFeature("noAutoTupling")), compileFile("tests/neg-custom-args/i1650.scala", allowDeepSubtypes), compileFile("tests/neg-custom-args/i3882.scala", allowDeepSubtypes), compileFile("tests/neg-custom-args/i4372.scala", allowDeepSubtypes), compileFile("tests/neg-custom-args/i1754.scala", allowDeepSubtypes), compileFile("tests/neg-custom-args/i12650.scala", allowDeepSubtypes), - compileFile("tests/neg-custom-args/i9517.scala", defaultOptions.and("-Xprint-types")), compileFile("tests/neg-custom-args/interop-polytypes.scala", allowDeepSubtypes.and("-Yexplicit-nulls")), compileFile("tests/neg-custom-args/conditionalWarnings.scala", allowDeepSubtypes.and("-deprecation").and("-Xfatal-warnings")), compileFilesInDir("tests/neg-custom-args/isInstanceOf", allowDeepSubtypes and "-Xfatal-warnings"), @@ -175,23 +141,7 @@ class CompilationTests { "tests/neg-custom-args/toplevel-samesource/nested/S.scala"), defaultOptions), compileFile("tests/neg-custom-args/i6300.scala", allowDeepSubtypes), - compileFile("tests/neg-custom-args/infix.scala", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")), - compileFile("tests/neg-custom-args/missing-targetName.scala", defaultOptions.and("-Yrequire-targetName", "-Xfatal-warnings")), - compileFile("tests/neg-custom-args/wildcards.scala", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")), - compileFile("tests/neg-custom-args/indentRight.scala", defaultOptions.and("-no-indent", "-Xfatal-warnings")), - compileDir("tests/neg-custom-args/adhoc-extension", defaultOptions.and("-source", "future", "-feature", "-Xfatal-warnings")), compileFile("tests/neg/i7575.scala", defaultOptions.withoutLanguageFeatures.and("-language:_")), - compileFile("tests/neg-custom-args/kind-projector.scala", defaultOptions.and("-Ykind-projector")), - compileFile("tests/neg-custom-args/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")), - compileFile("tests/neg-custom-args/typeclass-derivation2.scala", defaultOptions.and("-language:experimental.erasedDefinitions")), - compileFile("tests/neg-custom-args/deptypes.scala", defaultOptions.and("-language:experimental.dependent")), - compileFile("tests/neg-custom-args/matchable.scala", defaultOptions.and("-Xfatal-warnings", "-source", "future")), - compileFile("tests/neg-custom-args/i7314.scala", defaultOptions.and("-Xfatal-warnings", "-source", "future")), - compileFile("tests/neg-custom-args/capt-wf.scala", defaultOptions.and("-language:experimental.captureChecking", "-Xfatal-warnings")), - compileFile("tests/neg-custom-args/i13026.scala", defaultOptions.and("-print-lines")), - compileFile("tests/neg-custom-args/i13838.scala", defaultOptions.and("-Ximplicit-search-limit", "1000")), - compileFile("tests/neg-custom-args/jdk-9-app.scala", defaultOptions.and("-release:8")), - compileFile("tests/neg-custom-args/i10994.scala", defaultOptions.and("-source", "future")), ).checkExpectedErrors() } @@ -208,10 +158,6 @@ class CompilationTests { compileFile("tests/run-custom-args/typeclass-derivation1.scala", defaultOptions.without(yCheckOptions*)), compileFile("tests/run-custom-args/tuple-cons.scala", allowDeepSubtypes), compileFile("tests/run-custom-args/i5256.scala", allowDeepSubtypes), - compileFile("tests/run-custom-args/no-useless-forwarders.scala", defaultOptions and "-Xmixin-force-forwarders:false"), - compileFile("tests/run-custom-args/defaults-serizaliable-no-forwarders.scala", defaultOptions and "-Xmixin-force-forwarders:false"), - compileFilesInDir("tests/run-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")), - compileFilesInDir("tests/run-custom-args/fatal-warnings", defaultOptions.and("-Xfatal-warnings")), compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking")), compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes), compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init")), @@ -253,7 +199,6 @@ class CompilationTests { implicit val testGroup: TestGroup = TestGroup("explicitNullsNeg") aggregateTests( compileFilesInDir("tests/explicit-nulls/neg", explicitNullsOptions), - compileFilesInDir("tests/explicit-nulls/neg-patmat", explicitNullsOptions and "-Xfatal-warnings"), compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions), ) }.checkExpectedErrors() @@ -262,11 +207,7 @@ class CompilationTests { implicit val testGroup: TestGroup = TestGroup("explicitNullsPos") aggregateTests( compileFilesInDir("tests/explicit-nulls/pos", explicitNullsOptions), - compileFilesInDir("tests/explicit-nulls/pos-separate", explicitNullsOptions), - compileFilesInDir("tests/explicit-nulls/pos-patmat", explicitNullsOptions and "-Xfatal-warnings"), compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions and "-language:unsafeNulls"), - compileFile("tests/explicit-nulls/pos-special/i14682.scala", explicitNullsOptions and "-Ysafe-init"), - compileFile("tests/explicit-nulls/pos-special/i14947.scala", explicitNullsOptions and "-Ytest-pickler" and "-Xprint-types"), ) }.checkCompile() diff --git a/tests/explicit-nulls/neg-patmat/match-pat.scala b/tests/explicit-nulls/neg-patmat/match-pat.scala index fb7180d82e34..e285163340ae 100644 --- a/tests/explicit-nulls/neg-patmat/match-pat.scala +++ b/tests/explicit-nulls/neg-patmat/match-pat.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class Foo { val s: String = ??? diff --git a/tests/explicit-nulls/pos-special/i14682.scala b/tests/explicit-nulls/pos/i14682.scala similarity index 95% rename from tests/explicit-nulls/pos-special/i14682.scala rename to tests/explicit-nulls/pos/i14682.scala index 0c0619d8105b..0c9224e7122a 100644 --- a/tests/explicit-nulls/pos-special/i14682.scala +++ b/tests/explicit-nulls/pos/i14682.scala @@ -1,3 +1,5 @@ +// scalac: -Ysafe-init + class C1: sealed abstract class Name { type ThisName <: Name diff --git a/tests/explicit-nulls/pos-special/i14947.scala b/tests/explicit-nulls/pos/i14947.scala similarity index 84% rename from tests/explicit-nulls/pos-special/i14947.scala rename to tests/explicit-nulls/pos/i14947.scala index b8f013f325b1..6238077a0693 100644 --- a/tests/explicit-nulls/pos-special/i14947.scala +++ b/tests/explicit-nulls/pos/i14947.scala @@ -1,3 +1,5 @@ +// scalac: -Ytest-pickler -Xprint-types + class B: def g: String | Null = ??? diff --git a/tests/explicit-nulls/pos-separate/interop-enum-src/Day_1.java b/tests/explicit-nulls/pos/interop-enum-src-separate/Day_1.java similarity index 100% rename from tests/explicit-nulls/pos-separate/interop-enum-src/Day_1.java rename to tests/explicit-nulls/pos/interop-enum-src-separate/Day_1.java diff --git a/tests/explicit-nulls/pos-separate/interop-enum-src/Planet_2.java b/tests/explicit-nulls/pos/interop-enum-src-separate/Planet_2.java similarity index 100% rename from tests/explicit-nulls/pos-separate/interop-enum-src/Planet_2.java rename to tests/explicit-nulls/pos/interop-enum-src-separate/Planet_2.java diff --git a/tests/explicit-nulls/pos-separate/interop-enum-src/S_3.scala b/tests/explicit-nulls/pos/interop-enum-src-separate/S_3.scala similarity index 100% rename from tests/explicit-nulls/pos-separate/interop-enum-src/S_3.scala rename to tests/explicit-nulls/pos/interop-enum-src-separate/S_3.scala diff --git a/tests/explicit-nulls/pos-patmat/match-pat.scala b/tests/explicit-nulls/pos/match-pat.scala similarity index 95% rename from tests/explicit-nulls/pos-patmat/match-pat.scala rename to tests/explicit-nulls/pos/match-pat.scala index c9a408bde6d4..c4e13bbdacdc 100644 --- a/tests/explicit-nulls/pos-patmat/match-pat.scala +++ b/tests/explicit-nulls/pos/match-pat.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + // Ensure we don't get "the type test for argType cannot be checked at runtime" warning class Symbol { diff --git a/tests/explicit-nulls/pos-separate/notnull/J_2.java b/tests/explicit-nulls/pos/notnull-separate/J_2.java similarity index 100% rename from tests/explicit-nulls/pos-separate/notnull/J_2.java rename to tests/explicit-nulls/pos/notnull-separate/J_2.java diff --git a/tests/explicit-nulls/pos-separate/notnull/Nonnull_1.java b/tests/explicit-nulls/pos/notnull-separate/Nonnull_1.java similarity index 100% rename from tests/explicit-nulls/pos-separate/notnull/Nonnull_1.java rename to tests/explicit-nulls/pos/notnull-separate/Nonnull_1.java diff --git a/tests/explicit-nulls/pos-separate/notnull/S_3.scala b/tests/explicit-nulls/pos/notnull-separate/S_3.scala similarity index 100% rename from tests/explicit-nulls/pos-separate/notnull/S_3.scala rename to tests/explicit-nulls/pos/notnull-separate/S_3.scala diff --git a/tests/explicit-nulls/pos-patmat/unsafe-match-null-pat.scala b/tests/explicit-nulls/pos/unsafe-match-null-pat.scala similarity index 90% rename from tests/explicit-nulls/pos-patmat/unsafe-match-null-pat.scala rename to tests/explicit-nulls/pos/unsafe-match-null-pat.scala index 143a79d1e2f0..3c1eaf922550 100644 --- a/tests/explicit-nulls/pos-patmat/unsafe-match-null-pat.scala +++ b/tests/explicit-nulls/pos/unsafe-match-null-pat.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.language.unsafeNulls def test1 = diff --git a/tests/neg-custom-args/deprecation/i11022.check b/tests/neg-custom-args/deprecation/i11022.check deleted file mode 100644 index 464f2827c49e..000000000000 --- a/tests/neg-custom-args/deprecation/i11022.check +++ /dev/null @@ -1,20 +0,0 @@ --- Error: tests/neg-custom-args/deprecation/i11022.scala:8:7 ----------------------------------------------------------- -8 |val a: CaseClass = CaseClass(42) // error: deprecated type // error: deprecated apply method - | ^^^^^^^^^ - | class CaseClass is deprecated: no CaseClass --- Error: tests/neg-custom-args/deprecation/i11022.scala:8:19 ---------------------------------------------------------- -8 |val a: CaseClass = CaseClass(42) // error: deprecated type // error: deprecated apply method - | ^^^^^^^^^ - | class CaseClass is deprecated: no CaseClass --- Error: tests/neg-custom-args/deprecation/i11022.scala:9:7 ----------------------------------------------------------- -9 |val b: CaseClass = new CaseClass(42) // error: deprecated type // error: deprecated class - | ^^^^^^^^^ - | class CaseClass is deprecated: no CaseClass --- Error: tests/neg-custom-args/deprecation/i11022.scala:9:23 ---------------------------------------------------------- -9 |val b: CaseClass = new CaseClass(42) // error: deprecated type // error: deprecated class - | ^^^^^^^^^ - | class CaseClass is deprecated: no CaseClass --- Error: tests/neg-custom-args/deprecation/i11022.scala:10:14 --------------------------------------------------------- -10 |val c: Unit = CaseClass(42).magic() // error: deprecated apply method - | ^^^^^^^^^ - | class CaseClass is deprecated: no CaseClass diff --git a/tests/neg-custom-args/erased/erased-case-class.scala b/tests/neg-custom-args/erased/erased-case-class.scala deleted file mode 100644 index 692534d772b6..000000000000 --- a/tests/neg-custom-args/erased/erased-case-class.scala +++ /dev/null @@ -1 +0,0 @@ -case class Foo1(erased x: Int) // error // error diff --git a/tests/neg-custom-args/erased/erased-object.scala b/tests/neg-custom-args/erased/erased-object.scala deleted file mode 100644 index 99720f244ef5..000000000000 --- a/tests/neg-custom-args/erased/erased-object.scala +++ /dev/null @@ -1 +0,0 @@ -erased object Test // error diff --git a/tests/neg-custom-args/erased/erased-type.scala b/tests/neg-custom-args/erased/erased-type.scala deleted file mode 100644 index 62acb815442a..000000000000 --- a/tests/neg-custom-args/erased/erased-type.scala +++ /dev/null @@ -1,3 +0,0 @@ -class Test { - erased type T // error -} diff --git a/tests/neg-custom-args/erased/erased-var.scala b/tests/neg-custom-args/erased/erased-var.scala deleted file mode 100644 index 465b3362e529..000000000000 --- a/tests/neg-custom-args/erased/erased-var.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test { - erased var i: Int = 1 // error -} diff --git a/tests/neg-custom-args/erased/i6795.check b/tests/neg-custom-args/erased/i6795.check deleted file mode 100644 index 662012864244..000000000000 --- a/tests/neg-custom-args/erased/i6795.check +++ /dev/null @@ -1,4 +0,0 @@ --- Error: tests/neg-custom-args/erased/i6795.scala:1:13 ---------------------------------------------------------------- -1 |erased class Foo // error - |^^^^^^^^^^^^^^^^ - |modifier(s) `erased` incompatible with type definition diff --git a/tests/neg-custom-args/fatal-warnings/i11333.check b/tests/neg-custom-args/fatal-warnings/i11333.check deleted file mode 100644 index beef37c6460a..000000000000 --- a/tests/neg-custom-args/fatal-warnings/i11333.check +++ /dev/null @@ -1,30 +0,0 @@ --- [E167] Lossy Conversion Error: tests/neg-custom-args/fatal-warnings/i11333.scala:2:19 ------------------------------- -2 | val f1: Float = 123456789 // error - | ^^^^^^^^^ - | Widening conversion from Int to Float loses precision. - | Write `.toFloat` instead. --- [E167] Lossy Conversion Error: tests/neg-custom-args/fatal-warnings/i11333.scala:3:19 ------------------------------- -3 | val d1: Double = 1234567890123456789L // error - | ^^^^^^^^^^^^^^^^^^^^ - | Widening conversion from Long to Double loses precision. - | Write `.toDouble` instead. --- [E167] Lossy Conversion Error: tests/neg-custom-args/fatal-warnings/i11333.scala:4:19 ------------------------------- -4 | val f2: Float = 123456789L // error - | ^^^^^^^^^^ - | Widening conversion from Long to Float loses precision. - | Write `.toFloat` instead. --- [E167] Lossy Conversion Error: tests/neg-custom-args/fatal-warnings/i11333.scala:10:21 ------------------------------ -10 | val f1_b: Float = i1 // error - | ^^ - | Widening conversion from Int to Float loses precision. - | Write `.toFloat` instead. --- [E167] Lossy Conversion Error: tests/neg-custom-args/fatal-warnings/i11333.scala:11:21 ------------------------------ -11 | val d1_b: Double = l1 // error - | ^^ - | Widening conversion from Long to Double loses precision. - | Write `.toDouble` instead. --- [E167] Lossy Conversion Error: tests/neg-custom-args/fatal-warnings/i11333.scala:12:21 ------------------------------ -12 | val f2_b: Float = l2 // error - | ^^ - | Widening conversion from Long to Float loses precision. - | Write `.toFloat` instead. diff --git a/tests/neg-custom-args/fatal-warnings/i11963a.scala b/tests/neg-custom-args/fatal-warnings/i11963a.scala deleted file mode 100644 index 58d64d061162..000000000000 --- a/tests/neg-custom-args/fatal-warnings/i11963a.scala +++ /dev/null @@ -1 +0,0 @@ -open trait Foo // error diff --git a/tests/neg-custom-args/fatal-warnings/i13440.check b/tests/neg-custom-args/fatal-warnings/i13440.check deleted file mode 100644 index fde8133419b6..000000000000 --- a/tests/neg-custom-args/fatal-warnings/i13440.check +++ /dev/null @@ -1,12 +0,0 @@ --- Error: tests/neg-custom-args/fatal-warnings/i13440.scala:3:4 -------------------------------------------------------- -3 |def given = 42 // error - | ^ - | given is now a keyword, write `given` instead of given to keep it as an identifier --- Error: tests/neg-custom-args/fatal-warnings/i13440.scala:5:13 ------------------------------------------------------- -5 |case class C(enum: List[Int] = Nil) { // error - | ^ - | enum is now a keyword, write `enum` instead of enum to keep it as an identifier --- Error: tests/neg-custom-args/fatal-warnings/i13440.scala:6:11 ------------------------------------------------------- -6 | val s = s"$enum" // error - | ^ - | enum is now a keyword, write `enum` instead of enum to keep it as an identifier diff --git a/tests/neg-custom-args/fatal-warnings/i16728.check b/tests/neg-custom-args/fatal-warnings/i16728.check deleted file mode 100644 index a797baf19be0..000000000000 --- a/tests/neg-custom-args/fatal-warnings/i16728.check +++ /dev/null @@ -1,4 +0,0 @@ --- Error: tests/neg-custom-args/fatal-warnings/i16728.scala:16:11 ------------------------------------------------------ -16 | case tx : C[Int]#X => // error - | ^ - | the type test for C[Int] cannot be checked at runtime because its type arguments can't be determined from A diff --git a/tests/neg-custom-args/fatal-warnings/i4936.scala b/tests/neg-custom-args/fatal-warnings/i4936.scala deleted file mode 100644 index 65c026899e7e..000000000000 --- a/tests/neg-custom-args/fatal-warnings/i4936.scala +++ /dev/null @@ -1 +0,0 @@ -final object Foo // error diff --git a/tests/neg-custom-args/fatal-warnings/i6190b.check b/tests/neg-custom-args/fatal-warnings/i6190b.check deleted file mode 100644 index 8fc4e09896a9..000000000000 --- a/tests/neg-custom-args/fatal-warnings/i6190b.check +++ /dev/null @@ -1,4 +0,0 @@ --- Error: tests/neg-custom-args/fatal-warnings/i6190b.scala:3:29 ------------------------------------------------------- -3 |def foo = List("1", "2").map(Rule) // error - | ^^^^ - | The method `apply` is inserted. The auto insertion will be deprecated, please write `Rule.apply` explicitly. diff --git a/tests/neg-custom-args/fatal-warnings/i8711.check b/tests/neg-custom-args/fatal-warnings/i8711.check deleted file mode 100644 index 491d1678b5ac..000000000000 --- a/tests/neg-custom-args/fatal-warnings/i8711.check +++ /dev/null @@ -1,12 +0,0 @@ --- [E030] Match case Unreachable Error: tests/neg-custom-args/fatal-warnings/i8711.scala:7:9 --------------------------- -7 | 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-custom-args/fatal-warnings/i8711.scala:12:9 -------------------------- -12 | case x: C => x // error - | ^^^^ - | Unreachable case --- [E030] Match case Unreachable Error: tests/neg-custom-args/fatal-warnings/i8711.scala:17:9 -------------------------- -17 | case x: (B | C) => x // error - | ^^^^^^^^^^ - | Unreachable case diff --git a/tests/neg-custom-args/fatal-warnings/symbolic-packages.check b/tests/neg-custom-args/fatal-warnings/symbolic-packages.check deleted file mode 100644 index f5abe6ed0a36..000000000000 --- a/tests/neg-custom-args/fatal-warnings/symbolic-packages.check +++ /dev/null @@ -1,16 +0,0 @@ --- Error: tests/neg-custom-args/fatal-warnings/symbolic-packages.scala:1:8 --------------------------------------------- -1 |package `with spaces` { // error - | ^^^^^^^^^^^^^ - | The package name `with spaces` will be encoded on the classpath, and can lead to undefined behaviour. --- Error: tests/neg-custom-args/fatal-warnings/symbolic-packages.scala:5:10 -------------------------------------------- -5 |package +.* { // error // error - | ^ - | The package name `*` will be encoded on the classpath, and can lead to undefined behaviour. --- Error: tests/neg-custom-args/fatal-warnings/symbolic-packages.scala:5:8 --------------------------------------------- -5 |package +.* { // error // error - | ^ - | The package name `+` will be encoded on the classpath, and can lead to undefined behaviour. --- Error: tests/neg-custom-args/fatal-warnings/symbolic-packages.scala:9:16 -------------------------------------------- -9 |package object `mixed_*` { // error - | ^^^^^^^ - | The package name `mixed_*` will be encoded on the classpath, and can lead to undefined behaviour. diff --git a/tests/neg-custom-args/feature/i13946/BadPrinter.scala b/tests/neg-custom-args/feature/i13946/BadPrinter.scala deleted file mode 100644 index 3ab935de9711..000000000000 --- a/tests/neg-custom-args/feature/i13946/BadPrinter.scala +++ /dev/null @@ -1,4 +0,0 @@ -// in BadPrinter.scala -import language.future -class BadPrinter extends Printer: // error - override def print(s: String): Unit = println("Bad!!!") \ No newline at end of file diff --git a/tests/neg-custom-args/i10994.scala b/tests/neg-custom-args/i10994.scala deleted file mode 100644 index 65695ccf4352..000000000000 --- a/tests/neg-custom-args/i10994.scala +++ /dev/null @@ -1,2 +0,0 @@ -def foo = true match - case (b: Boolean): Boolean => () // error diff --git a/tests/neg-custom-args/nowarn/nowarn-typer-error.check b/tests/neg-custom-args/nowarn/nowarn-typer-error.check deleted file mode 100644 index a6c915807dca..000000000000 --- a/tests/neg-custom-args/nowarn/nowarn-typer-error.check +++ /dev/null @@ -1,6 +0,0 @@ --- [E006] Not Found Error: tests/neg-custom-args/nowarn/nowarn-typer-error.scala:4:11 ---------------------------------- -4 | def t1 = / // error - | ^ - | Not found: / - | - | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/wildcards.scala b/tests/neg-custom-args/wildcards.scala index e8ac77c116be..cbe9c6936f16 100644 --- a/tests/neg-custom-args/wildcards.scala +++ b/tests/neg-custom-args/wildcards.scala @@ -1,3 +1,5 @@ +// scalac: -source future -deprecation -Xfatal-warnings + object Test { val xs: List[_] = List(1, 2, 3) // error val ys: Map[_ <: AnyRef, _ >: Null] = Map() // error // error diff --git a/tests/neg-custom-args/no-experimental/14034.scala b/tests/neg/14034.scala similarity index 90% rename from tests/neg-custom-args/no-experimental/14034.scala rename to tests/neg/14034.scala index ab824c43395e..756dd4a13e9e 100644 --- a/tests/neg-custom-args/no-experimental/14034.scala +++ b/tests/neg/14034.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental @experimental trait Exp diff --git a/tests/neg-custom-args/deprecation/14034b.scala b/tests/neg/14034b.scala similarity index 88% rename from tests/neg-custom-args/deprecation/14034b.scala rename to tests/neg/14034b.scala index 07960bba9574..c299b1dfe5d7 100644 --- a/tests/neg-custom-args/deprecation/14034b.scala +++ b/tests/neg/14034b.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings -deprecation @deprecated trait Exp @deprecated val exp = 1 diff --git a/tests/neg-custom-args/fatal-warnings/IsInstanceOfClassTag.scala b/tests/neg/IsInstanceOfClassTag.scala similarity index 94% rename from tests/neg-custom-args/fatal-warnings/IsInstanceOfClassTag.scala rename to tests/neg/IsInstanceOfClassTag.scala index a398d7bdaf24..45d1c5550dff 100644 --- a/tests/neg-custom-args/fatal-warnings/IsInstanceOfClassTag.scala +++ b/tests/neg/IsInstanceOfClassTag.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.reflect.ClassTag object IsInstanceOfClassTag { diff --git a/tests/neg-custom-args/fatal-warnings/IsInstanceOfClassTag2.scala b/tests/neg/IsInstanceOfClassTag2.scala similarity index 93% rename from tests/neg-custom-args/fatal-warnings/IsInstanceOfClassTag2.scala rename to tests/neg/IsInstanceOfClassTag2.scala index d9782bc14f34..ee1f9535a226 100644 --- a/tests/neg-custom-args/fatal-warnings/IsInstanceOfClassTag2.scala +++ b/tests/neg/IsInstanceOfClassTag2.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.reflect.TypeTest object IsInstanceOfClassTag { diff --git a/tests/neg-custom-args/adhoc-extension/A.scala b/tests/neg/adhoc-extension/A.scala similarity index 100% rename from tests/neg-custom-args/adhoc-extension/A.scala rename to tests/neg/adhoc-extension/A.scala diff --git a/tests/neg-custom-args/adhoc-extension/B.scala b/tests/neg/adhoc-extension/B.scala similarity index 79% rename from tests/neg-custom-args/adhoc-extension/B.scala rename to tests/neg/adhoc-extension/B.scala index dd1971e1835f..6b13e66b3ada 100644 --- a/tests/neg-custom-args/adhoc-extension/B.scala +++ b/tests/neg/adhoc-extension/B.scala @@ -1,3 +1,5 @@ +// scalac: -source future -feature -Xfatal-warnings + package adhoc class B extends A // error: adhoc-extension (under -strict -feature -Xfatal-warnings) class C extends A // error diff --git a/tests/neg-custom-args/autoTuplingTest.scala b/tests/neg/autoTuplingTestb.scala similarity index 88% rename from tests/neg-custom-args/autoTuplingTest.scala rename to tests/neg/autoTuplingTestb.scala index 7321a83827bb..c12e68e2c5b4 100644 --- a/tests/neg-custom-args/autoTuplingTest.scala +++ b/tests/neg/autoTuplingTestb.scala @@ -1,3 +1,5 @@ +// scalac: -language:noAutoTupling + object autoTupling { val x = Some(1, 2) // error when running with -language:noAutoTupling diff --git a/tests/neg-custom-args/avoid-warn-deprecation.scala b/tests/neg/avoid-warn-deprecation.scala similarity index 83% rename from tests/neg-custom-args/avoid-warn-deprecation.scala rename to tests/neg/avoid-warn-deprecation.scala index fc8d71dd7f60..4d3638a821b1 100644 --- a/tests/neg-custom-args/avoid-warn-deprecation.scala +++ b/tests/neg/avoid-warn-deprecation.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -feature + object A { @deprecated("use bar instead of this one", "0.2.3") def foo: Int = 3 diff --git a/tests/neg-custom-args/erased/by-name.scala b/tests/neg/by-name.scala similarity index 75% rename from tests/neg-custom-args/erased/by-name.scala rename to tests/neg/by-name.scala index 707cfd96734b..7c31ffffa493 100644 --- a/tests/neg-custom-args/erased/by-name.scala +++ b/tests/neg/by-name.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + def f(x: => Int, erased y: => Int) = x // error def g(erased x: => Int, y: => Int) = y // error diff --git a/tests/neg-custom-args/capt-wf.scala b/tests/neg/capt-wf.scala similarity index 94% rename from tests/neg-custom-args/capt-wf.scala rename to tests/neg/capt-wf.scala index 67e1bc9906fe..f9fa71361b40 100644 --- a/tests/neg-custom-args/capt-wf.scala +++ b/tests/neg/capt-wf.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.captureChecking -Xfatal-warnings + class C type Cap = C^ diff --git a/tests/neg-custom-args/fatal-warnings/classtag-typetest/3_0-migration.scala b/tests/neg/classtag-typetest/3_0-migration.scala similarity index 100% rename from tests/neg-custom-args/fatal-warnings/classtag-typetest/3_0-migration.scala rename to tests/neg/classtag-typetest/3_0-migration.scala diff --git a/tests/neg-custom-args/fatal-warnings/classtag-typetest/3_0.scala b/tests/neg/classtag-typetest/3_0.scala similarity index 100% rename from tests/neg-custom-args/fatal-warnings/classtag-typetest/3_0.scala rename to tests/neg/classtag-typetest/3_0.scala diff --git a/tests/neg-custom-args/fatal-warnings/classtag-typetest/3_1-migration.scala b/tests/neg/classtag-typetest/3_1-migration.scala similarity index 83% rename from tests/neg-custom-args/fatal-warnings/classtag-typetest/3_1-migration.scala rename to tests/neg/classtag-typetest/3_1-migration.scala index da26fd3c5569..369c530ad04c 100644 --- a/tests/neg-custom-args/fatal-warnings/classtag-typetest/3_1-migration.scala +++ b/tests/neg/classtag-typetest/3_1-migration.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.language.`future-migration` import scala.reflect.ClassTag diff --git a/tests/neg-custom-args/fatal-warnings/classtag-typetest/3_1.scala b/tests/neg/classtag-typetest/3_1.scala similarity index 82% rename from tests/neg-custom-args/fatal-warnings/classtag-typetest/3_1.scala rename to tests/neg/classtag-typetest/3_1.scala index b21fb0606b8e..5aa1759097cb 100644 --- a/tests/neg-custom-args/fatal-warnings/classtag-typetest/3_1.scala +++ b/tests/neg/classtag-typetest/3_1.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.language.future import scala.reflect.ClassTag diff --git a/tests/neg-custom-args/explain/constructor-proxy-shadowing.check b/tests/neg/constructor-proxy-shadowing.check similarity index 86% rename from tests/neg-custom-args/explain/constructor-proxy-shadowing.check rename to tests/neg/constructor-proxy-shadowing.check index db223ba33640..f45b9b3205c3 100644 --- a/tests/neg-custom-args/explain/constructor-proxy-shadowing.check +++ b/tests/neg/constructor-proxy-shadowing.check @@ -1,5 +1,5 @@ --- [E177] Reference Error: tests/neg-custom-args/explain/constructor-proxy-shadowing.scala:10:12 ----------------------- -10 | val x = A22("") // error: shadowing +-- [E177] Reference Error: tests/neg/constructor-proxy-shadowing.scala:11:12 ------------------------------------------- +11 | val x = A22("") // error: shadowing | ^^^ | Reference to constructor proxy for class A22 in class A | shadows outer reference to method A22 in object Test @@ -23,8 +23,8 @@ | To disambiguate, use an explicit `new` if you mean the former, | or use a full prefix for A22 if you mean the latter. -------------------------------------------------------------------------------------------------------------------- --- [E177] Reference Error: tests/neg-custom-args/explain/constructor-proxy-shadowing.scala:11:12 ----------------------- -11 | val y = A33("") // error: shadowing +-- [E177] Reference Error: tests/neg/constructor-proxy-shadowing.scala:12:12 ------------------------------------------- +12 | val y = A33("") // error: shadowing | ^^^ | Reference to constructor proxy for class A33 in class A | shadows outer reference to object A33 in object Test @@ -48,8 +48,8 @@ | To disambiguate, use an explicit `new` if you mean the former, | or use a full prefix for A33 if you mean the latter. -------------------------------------------------------------------------------------------------------------------- --- [E177] Reference Error: tests/neg-custom-args/explain/constructor-proxy-shadowing.scala:16:8 ------------------------ -16 |val x = Seq(3) // error: shadowing +-- [E177] Reference Error: tests/neg/constructor-proxy-shadowing.scala:17:8 -------------------------------------------- +17 |val x = Seq(3) // error: shadowing | ^^^ | Reference to constructor proxy for class Seq | shadows outer reference to getter Seq in package scala diff --git a/tests/neg-custom-args/explain/constructor-proxy-shadowing.scala b/tests/neg/constructor-proxy-shadowing.scala similarity index 94% rename from tests/neg-custom-args/explain/constructor-proxy-shadowing.scala rename to tests/neg/constructor-proxy-shadowing.scala index c47fc2f4859b..0e2cccfc057a 100644 --- a/tests/neg-custom-args/explain/constructor-proxy-shadowing.scala +++ b/tests/neg/constructor-proxy-shadowing.scala @@ -1,3 +1,4 @@ +// scalac: -explain object Test extends App { def A22(s: String): String = s diff --git a/tests/neg-custom-args/feature/convertible.scala b/tests/neg/convertible.scala similarity index 94% rename from tests/neg-custom-args/feature/convertible.scala rename to tests/neg/convertible.scala index 1b9e1c79f011..45b0af88dab1 100644 --- a/tests/neg-custom-args/feature/convertible.scala +++ b/tests/neg/convertible.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -feature + import language.experimental.into class Text(val str: String) diff --git a/tests/neg-custom-args/deptypes.scala b/tests/neg/deptypes.scala similarity index 89% rename from tests/neg-custom-args/deptypes.scala rename to tests/neg/deptypes.scala index f01be10f2217..0232c5ab2651 100644 --- a/tests/neg-custom-args/deptypes.scala +++ b/tests/neg/deptypes.scala @@ -1,3 +1,4 @@ +// scalac: -language:experimental.dependent type Vec[T] = (n: Int) =>> Array[T] // error: not yet implemented diff --git a/tests/neg-custom-args/fatal-warnings/enum-variance.check b/tests/neg/enum-variance.check similarity index 58% rename from tests/neg-custom-args/fatal-warnings/enum-variance.check rename to tests/neg/enum-variance.check index b525d4d94ba6..f250df84cae6 100644 --- a/tests/neg-custom-args/fatal-warnings/enum-variance.check +++ b/tests/neg/enum-variance.check @@ -1,10 +1,10 @@ --- Error: tests/neg-custom-args/fatal-warnings/enum-variance.scala:2:12 ------------------------------------------------ -2 | case Refl(f: T => T) // error: enum case Refl requires explicit declaration of type T +-- Error: tests/neg/enum-variance.scala:4:12 --------------------------------------------------------------------------- +4 | case Refl(f: T => T) // error: enum case Refl requires explicit declaration of type T | ^^^^^^^^^ | contravariant type T occurs in covariant position in type T => T of value f | enum case Refl requires explicit declaration of type T to resolve this issue. | See an example at https://docs.scala-lang.org/scala3/reference/enums/adts.html#parameter-variance-of-enums --- Error: tests/neg-custom-args/fatal-warnings/enum-variance.scala:5:16 ------------------------------------------------ -5 | case Refl[-T](f: T => T) extends ExplicitView[T] // error: contravariant type T occurs in covariant position +-- Error: tests/neg/enum-variance.scala:7:16 --------------------------------------------------------------------------- +7 | case Refl[-T](f: T => T) extends ExplicitView[T] // error: contravariant type T occurs in covariant position | ^^^^^^^^^ | contravariant type T occurs in covariant position in type T => T of value f diff --git a/tests/neg-custom-args/fatal-warnings/enum-variance.scala b/tests/neg/enum-variance.scala similarity index 93% rename from tests/neg-custom-args/fatal-warnings/enum-variance.scala rename to tests/neg/enum-variance.scala index efe0dbbc6cdd..1bf4df5ac8dd 100644 --- a/tests/neg-custom-args/fatal-warnings/enum-variance.scala +++ b/tests/neg/enum-variance.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + enum View[-T]: case Refl(f: T => T) // error: enum case Refl requires explicit declaration of type T diff --git a/tests/neg-custom-args/erased/erased-1.scala b/tests/neg/erased-1.scala similarity index 90% rename from tests/neg-custom-args/erased/erased-1.scala rename to tests/neg/erased-1.scala index 552d2cc7e086..178d0a4ff3fe 100644 --- a/tests/neg-custom-args/erased/erased-1.scala +++ b/tests/neg/erased-1.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def foo0(a: Int): Int = a def foo1(erased a: Int): Int = { diff --git a/tests/neg-custom-args/erased/erased-2.scala b/tests/neg/erased-2.scala similarity index 92% rename from tests/neg-custom-args/erased/erased-2.scala rename to tests/neg/erased-2.scala index bab269061899..785c0cc8b848 100644 --- a/tests/neg-custom-args/erased/erased-2.scala +++ b/tests/neg/erased-2.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def foo0(a: Int): Int = a def foo1(erased a: Int): Int = { diff --git a/tests/neg-custom-args/erased/erased-24.scala b/tests/neg/erased-24.scala similarity index 89% rename from tests/neg-custom-args/erased/erased-24.scala rename to tests/neg/erased-24.scala index dc39d4f9b653..e701ba8ff577 100644 --- a/tests/neg-custom-args/erased/erased-24.scala +++ b/tests/neg/erased-24.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + // Could become a run test if we had totality checking for erased arguments object Test { diff --git a/tests/neg-custom-args/erased/erased-3.scala b/tests/neg/erased-3.scala similarity index 93% rename from tests/neg-custom-args/erased/erased-3.scala rename to tests/neg/erased-3.scala index 16e18b320dc5..365dc1be7744 100644 --- a/tests/neg-custom-args/erased/erased-3.scala +++ b/tests/neg/erased-3.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def foo0(a: Int): Int = a def foo1(erased a: Int): Int = { diff --git a/tests/neg-custom-args/erased/erased-4.scala b/tests/neg/erased-4.scala similarity index 83% rename from tests/neg-custom-args/erased/erased-4.scala rename to tests/neg/erased-4.scala index 1583c5297cd1..ee379e9085eb 100644 --- a/tests/neg-custom-args/erased/erased-4.scala +++ b/tests/neg/erased-4.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/neg-custom-args/erased/erased-5.scala b/tests/neg/erased-5.scala similarity index 86% rename from tests/neg-custom-args/erased/erased-5.scala rename to tests/neg/erased-5.scala index 3a4ea33629bf..34040844e101 100644 --- a/tests/neg-custom-args/erased/erased-5.scala +++ b/tests/neg/erased-5.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { type UU[T] = (erased T) => Int diff --git a/tests/neg-custom-args/erased/erased-6.scala b/tests/neg/erased-6.scala similarity index 78% rename from tests/neg-custom-args/erased/erased-6.scala rename to tests/neg/erased-6.scala index 21d77d03afc2..53c720aead21 100644 --- a/tests/neg-custom-args/erased/erased-6.scala +++ b/tests/neg/erased-6.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { erased def foo: Foo = new Foo foo.x() // error diff --git a/tests/neg-custom-args/erased/erased-args-lifted.scala b/tests/neg/erased-args-lifted.scala similarity index 83% rename from tests/neg-custom-args/erased/erased-args-lifted.scala rename to tests/neg/erased-args-lifted.scala index 0f4b9e11ca1c..f59c64c07bb1 100644 --- a/tests/neg-custom-args/erased/erased-args-lifted.scala +++ b/tests/neg/erased-args-lifted.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def foo(a: Int)(b: Int, c: Int) = 42 erased def bar(i: Int): Int = { diff --git a/tests/neg-custom-args/erased/erased-assign.scala b/tests/neg/erased-assign.scala similarity index 73% rename from tests/neg-custom-args/erased/erased-assign.scala rename to tests/neg/erased-assign.scala index 5f1bd9250e84..4392b7bbd3c9 100644 --- a/tests/neg-custom-args/erased/erased-assign.scala +++ b/tests/neg/erased-assign.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { var i: Int = 1 def foo(erased a: Int): Int = { diff --git a/tests/neg/erased-case-class.scala b/tests/neg/erased-case-class.scala new file mode 100644 index 000000000000..0a9ec2cd8257 --- /dev/null +++ b/tests/neg/erased-case-class.scala @@ -0,0 +1,3 @@ +// scalac: -language:experimental.erasedDefinitions + +case class Foo1(erased x: Int) // error // error diff --git a/tests/neg-custom-args/erased/erased-def-rhs.scala b/tests/neg/erased-def-rhs.scala similarity index 60% rename from tests/neg-custom-args/erased/erased-def-rhs.scala rename to tests/neg/erased-def-rhs.scala index 23417583f860..684f096d72a1 100644 --- a/tests/neg-custom-args/erased/erased-def-rhs.scala +++ b/tests/neg/erased-def-rhs.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def f(erased i: Int) = { def j: Int = i // error diff --git a/tests/neg-custom-args/erased/erased-if-else.scala b/tests/neg/erased-if-else.scala similarity index 83% rename from tests/neg-custom-args/erased/erased-if-else.scala rename to tests/neg/erased-if-else.scala index 503dfc0bd1e3..3511a561884c 100644 --- a/tests/neg-custom-args/erased/erased-if-else.scala +++ b/tests/neg/erased-if-else.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { var b = true def foo(erased a: Boolean): Boolean = { diff --git a/tests/neg-custom-args/erased/erased-implicit.scala b/tests/neg/erased-implicit.scala similarity index 70% rename from tests/neg-custom-args/erased/erased-implicit.scala rename to tests/neg/erased-implicit.scala index 2df2ad88db4d..9eb31b54f7cc 100644 --- a/tests/neg-custom-args/erased/erased-implicit.scala +++ b/tests/neg/erased-implicit.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { fun // error diff --git a/tests/neg-custom-args/erased/erased-in-tuples.scala b/tests/neg/erased-in-tuples.scala similarity index 86% rename from tests/neg-custom-args/erased/erased-in-tuples.scala rename to tests/neg/erased-in-tuples.scala index 11a251c3bd4d..52c48b33a6c9 100644 --- a/tests/neg-custom-args/erased/erased-in-tuples.scala +++ b/tests/neg/erased-in-tuples.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + @main def Test() = val x = 5 val y = 7 diff --git a/tests/neg-custom-args/erased/erased-lazy-val.scala b/tests/neg/erased-lazy-val.scala similarity index 50% rename from tests/neg-custom-args/erased/erased-lazy-val.scala rename to tests/neg/erased-lazy-val.scala index 7b89809eddff..39fb5eedbf0f 100644 --- a/tests/neg-custom-args/erased/erased-lazy-val.scala +++ b/tests/neg/erased-lazy-val.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { erased lazy val i: Int = 1 // error } diff --git a/tests/neg-custom-args/erased/erased-machine-state-encoding-with-inline.scala b/tests/neg/erased-machine-state-encoding-with-inline.scala similarity index 93% rename from tests/neg-custom-args/erased/erased-machine-state-encoding-with-inline.scala rename to tests/neg/erased-machine-state-encoding-with-inline.scala index f2d1e8300b45..49d708642916 100644 --- a/tests/neg-custom-args/erased/erased-machine-state-encoding-with-inline.scala +++ b/tests/neg/erased-machine-state-encoding-with-inline.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + import scala.compiletime.* sealed trait State diff --git a/tests/neg-custom-args/erased/erased-match.scala b/tests/neg/erased-match.scala similarity index 84% rename from tests/neg-custom-args/erased/erased-match.scala rename to tests/neg/erased-match.scala index 2d8057519bfc..fc61dca8497b 100644 --- a/tests/neg-custom-args/erased/erased-match.scala +++ b/tests/neg/erased-match.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { var b = true def foo(erased a: Int): Int = { diff --git a/tests/neg/erased-object.scala b/tests/neg/erased-object.scala new file mode 100644 index 000000000000..98db2492eb42 --- /dev/null +++ b/tests/neg/erased-object.scala @@ -0,0 +1,3 @@ +// scalac: -language:experimental.erasedDefinitions + +erased object Test // error diff --git a/tests/neg-custom-args/erased/erased-path.scala b/tests/neg/erased-path.scala similarity index 78% rename from tests/neg-custom-args/erased/erased-path.scala rename to tests/neg/erased-path.scala index f7fbda262e8e..e8523374b5c2 100644 --- a/tests/neg-custom-args/erased/erased-path.scala +++ b/tests/neg/erased-path.scala @@ -1,3 +1,4 @@ +// scalac: -language:experimental.erasedDefinitions trait Sys { type X } diff --git a/tests/neg-custom-args/erased/erased-pathdep-1.scala b/tests/neg/erased-pathdep-1.scala similarity index 91% rename from tests/neg-custom-args/erased/erased-pathdep-1.scala rename to tests/neg/erased-pathdep-1.scala index 55e8b89013b2..03dc1c7a0778 100644 --- a/tests/neg-custom-args/erased/erased-pathdep-1.scala +++ b/tests/neg/erased-pathdep-1.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + // Could become a neg test if we had totality checking for erased arguments object Test { diff --git a/tests/neg-custom-args/erased/erased-pathdep-2.scala b/tests/neg/erased-pathdep-2.scala similarity index 84% rename from tests/neg-custom-args/erased/erased-pathdep-2.scala rename to tests/neg/erased-pathdep-2.scala index 29dcf216b32e..2e900ab7cd91 100644 --- a/tests/neg-custom-args/erased/erased-pathdep-2.scala +++ b/tests/neg/erased-pathdep-2.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + // Could become a neg test if we had totality checking for erased arguments object Test { diff --git a/tests/neg-custom-args/erased/erased-return.scala b/tests/neg/erased-return.scala similarity index 77% rename from tests/neg-custom-args/erased/erased-return.scala rename to tests/neg/erased-return.scala index f7cf15a079be..9dab55292161 100644 --- a/tests/neg-custom-args/erased/erased-return.scala +++ b/tests/neg/erased-return.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { var b = true def foo(erased a: Int): Int = { diff --git a/tests/neg-custom-args/erased/erased-singleton.scala b/tests/neg/erased-singleton.scala similarity index 61% rename from tests/neg-custom-args/erased/erased-singleton.scala rename to tests/neg/erased-singleton.scala index d1aad7093e4c..982b185f5471 100644 --- a/tests/neg-custom-args/erased/erased-singleton.scala +++ b/tests/neg/erased-singleton.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + trait Sys trait Obj { diff --git a/tests/neg-custom-args/erased/erased-try.scala b/tests/neg/erased-try.scala similarity index 80% rename from tests/neg-custom-args/erased/erased-try.scala rename to tests/neg/erased-try.scala index 3e9aae8ab9a4..a3df0c584a9c 100644 --- a/tests/neg-custom-args/erased/erased-try.scala +++ b/tests/neg/erased-try.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def foo(erased a: Int): Int = { try { diff --git a/tests/neg/erased-type.scala b/tests/neg/erased-type.scala new file mode 100644 index 000000000000..132565f98d5b --- /dev/null +++ b/tests/neg/erased-type.scala @@ -0,0 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + +class Test { + erased type T // error +} diff --git a/tests/neg-custom-args/erased/erased-val-rhs.scala b/tests/neg/erased-val-rhs.scala similarity index 60% rename from tests/neg-custom-args/erased/erased-val-rhs.scala rename to tests/neg/erased-val-rhs.scala index 1b904c671478..b05015db497a 100644 --- a/tests/neg-custom-args/erased/erased-val-rhs.scala +++ b/tests/neg/erased-val-rhs.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def f(erased i: Int) = { val j: Int = i // error diff --git a/tests/neg-custom-args/erased/erased-value-class.scala b/tests/neg/erased-value-class.scala similarity index 66% rename from tests/neg-custom-args/erased/erased-value-class.scala rename to tests/neg/erased-value-class.scala index 65cd3e2f961b..2f63c726c967 100644 --- a/tests/neg-custom-args/erased/erased-value-class.scala +++ b/tests/neg/erased-value-class.scala @@ -1,3 +1,4 @@ +// scalac: -language:experimental.erasedDefinitions class Foo(erased x: Int) extends AnyVal // error diff --git a/tests/neg/erased-var.scala b/tests/neg/erased-var.scala new file mode 100644 index 000000000000..abead3a2a0e1 --- /dev/null +++ b/tests/neg/erased-var.scala @@ -0,0 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + +object Test { + erased var i: Int = 1 // error +} diff --git a/tests/pos-custom-args/erasedInline.scala b/tests/neg/erasedInline.scala similarity index 100% rename from tests/pos-custom-args/erasedInline.scala rename to tests/neg/erasedInline.scala diff --git a/tests/neg-custom-args/erased/erasedValue.scala b/tests/neg/erasedValueb.scala similarity index 76% rename from tests/neg-custom-args/erased/erasedValue.scala rename to tests/neg/erasedValueb.scala index 5519a04b5b15..b4d24c584487 100644 --- a/tests/neg-custom-args/erased/erasedValue.scala +++ b/tests/neg/erasedValueb.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + import scala.compiletime.erasedValue object Test { def foo0(a: Int): Int = 3 diff --git a/tests/neg-custom-args/no-experimental/experimental-2.scala b/tests/neg/experimental-2.scala similarity index 87% rename from tests/neg-custom-args/no-experimental/experimental-2.scala rename to tests/neg/experimental-2.scala index e2a8dcef58b8..2b56af377c89 100644 --- a/tests/neg-custom-args/no-experimental/experimental-2.scala +++ b/tests/neg/experimental-2.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + class Test7 { import scala.language.experimental import experimental.genericNumberLiterals // error: no aliases can be used to refer to a language import diff --git a/tests/neg-custom-args/no-experimental/experimental-erased.scala b/tests/neg/experimental-erased.scala similarity index 86% rename from tests/neg-custom-args/no-experimental/experimental-erased.scala rename to tests/neg/experimental-erased.scala index c80c3e0d4b49..a26c3a5b04c1 100644 --- a/tests/neg-custom-args/no-experimental/experimental-erased.scala +++ b/tests/neg/experimental-erased.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import language.experimental.erasedDefinitions import annotation.experimental diff --git a/tests/neg-custom-args/no-experimental/experimental-imports.scala b/tests/neg/experimental-imports.scala similarity index 98% rename from tests/neg-custom-args/no-experimental/experimental-imports.scala rename to tests/neg/experimental-imports.scala index 63a150978b1c..70089afb764f 100644 --- a/tests/neg-custom-args/no-experimental/experimental-imports.scala +++ b/tests/neg/experimental-imports.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimental-nested-imports-2.scala b/tests/neg/experimental-nested-imports-2.scala similarity index 97% rename from tests/neg-custom-args/no-experimental/experimental-nested-imports-2.scala rename to tests/neg/experimental-nested-imports-2.scala index a4962c6153a0..6e84f4114bb4 100644 --- a/tests/neg-custom-args/no-experimental/experimental-nested-imports-2.scala +++ b/tests/neg/experimental-nested-imports-2.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental class Class1: diff --git a/tests/neg-custom-args/no-experimental/experimental-nested-imports-3.scala b/tests/neg/experimental-nested-imports-3.scala similarity index 96% rename from tests/neg-custom-args/no-experimental/experimental-nested-imports-3.scala rename to tests/neg/experimental-nested-imports-3.scala index 77fbe41479d2..bd048d199c73 100644 --- a/tests/neg-custom-args/no-experimental/experimental-nested-imports-3.scala +++ b/tests/neg/experimental-nested-imports-3.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental class Class1: diff --git a/tests/neg-custom-args/no-experimental/experimental-nested-imports.scala b/tests/neg/experimental-nested-imports.scala similarity index 97% rename from tests/neg-custom-args/no-experimental/experimental-nested-imports.scala rename to tests/neg/experimental-nested-imports.scala index 180c43b9f671..a7949becbe83 100644 --- a/tests/neg-custom-args/no-experimental/experimental-nested-imports.scala +++ b/tests/neg/experimental-nested-imports.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental class Class1: diff --git a/tests/neg-custom-args/no-experimental/experimental-package-imports.scala b/tests/neg/experimental-package-imports.scala similarity index 94% rename from tests/neg-custom-args/no-experimental/experimental-package-imports.scala rename to tests/neg/experimental-package-imports.scala index 047b3eb61e82..8ad986e3a61f 100644 --- a/tests/neg-custom-args/no-experimental/experimental-package-imports.scala +++ b/tests/neg/experimental-package-imports.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental package foo { diff --git a/tests/neg-custom-args/no-experimental/experimental.scala b/tests/neg/experimental.scala similarity index 96% rename from tests/neg-custom-args/no-experimental/experimental.scala rename to tests/neg/experimental.scala index 42d0d8066c35..e11ba17f3c69 100644 --- a/tests/neg-custom-args/no-experimental/experimental.scala +++ b/tests/neg/experimental.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + class Test0 { import language.experimental.namedTypeArguments // error object Foo { diff --git a/tests/neg-custom-args/no-experimental/experimentalAnnot.scala b/tests/neg/experimentalAnnot.scala similarity index 92% rename from tests/neg-custom-args/no-experimental/experimentalAnnot.scala rename to tests/neg/experimentalAnnot.scala index e6dfbf28f8bb..4e43418e4fc0 100644 --- a/tests/neg-custom-args/no-experimental/experimentalAnnot.scala +++ b/tests/neg/experimentalAnnot.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental class myExperimentalAnnot extends scala.annotation.Annotation diff --git a/tests/neg-custom-args/no-experimental/experimentalCaseClass.scala b/tests/neg/experimentalCaseClass.scala similarity index 92% rename from tests/neg-custom-args/no-experimental/experimentalCaseClass.scala rename to tests/neg/experimentalCaseClass.scala index b112c8a1213a..211517a2e4f8 100644 --- a/tests/neg-custom-args/no-experimental/experimentalCaseClass.scala +++ b/tests/neg/experimentalCaseClass.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalDefaultParams.scala b/tests/neg/experimentalDefaultParams.scala similarity index 92% rename from tests/neg-custom-args/no-experimental/experimentalDefaultParams.scala rename to tests/neg/experimentalDefaultParams.scala index 4dedb3afa11d..ab396b45fc00 100644 --- a/tests/neg-custom-args/no-experimental/experimentalDefaultParams.scala +++ b/tests/neg/experimentalDefaultParams.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental def x = 2 diff --git a/tests/neg-custom-args/no-experimental/experimentalEnum.scala b/tests/neg/experimentalEnum.scala similarity index 83% rename from tests/neg-custom-args/no-experimental/experimentalEnum.scala rename to tests/neg/experimentalEnum.scala index 1cbe78ca5427..0317ce828f2e 100644 --- a/tests/neg-custom-args/no-experimental/experimentalEnum.scala +++ b/tests/neg/experimentalEnum.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalErased.scala b/tests/neg/experimentalErased.scala similarity index 92% rename from tests/neg-custom-args/no-experimental/experimentalErased.scala rename to tests/neg/experimentalErased.scala index 6fcb11a3cc2f..49663dd9d8fa 100644 --- a/tests/neg-custom-args/no-experimental/experimentalErased.scala +++ b/tests/neg/experimentalErased.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import language.experimental.erasedDefinitions import annotation.experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalInline.scala b/tests/neg/experimentalInline.scala similarity index 78% rename from tests/neg-custom-args/no-experimental/experimentalInline.scala rename to tests/neg/experimentalInline.scala index eb49bf15d11a..367dcaba29c5 100644 --- a/tests/neg-custom-args/no-experimental/experimentalInline.scala +++ b/tests/neg/experimentalInline.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalInline2.scala b/tests/neg/experimentalInline2.scala similarity index 80% rename from tests/neg-custom-args/no-experimental/experimentalInline2.scala rename to tests/neg/experimentalInline2.scala index c40eb050a832..b2fbce922099 100644 --- a/tests/neg-custom-args/no-experimental/experimentalInline2.scala +++ b/tests/neg/experimentalInline2.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalMembers.scala b/tests/neg/experimentalMembers.scala similarity index 94% rename from tests/neg-custom-args/no-experimental/experimentalMembers.scala rename to tests/neg/experimentalMembers.scala index e30f27b069a8..e7d3f62de5e7 100644 --- a/tests/neg-custom-args/no-experimental/experimentalMembers.scala +++ b/tests/neg/experimentalMembers.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental def x = 2 diff --git a/tests/neg-custom-args/no-experimental/experimentalOverride.scala b/tests/neg/experimentalOverride.scala similarity index 95% rename from tests/neg-custom-args/no-experimental/experimentalOverride.scala rename to tests/neg/experimentalOverride.scala index 653bd3b23da4..984af350bb1a 100644 --- a/tests/neg-custom-args/no-experimental/experimentalOverride.scala +++ b/tests/neg/experimentalOverride.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalRHS.scala b/tests/neg/experimentalRHS.scala similarity index 93% rename from tests/neg-custom-args/no-experimental/experimentalRHS.scala rename to tests/neg/experimentalRHS.scala index 27143c120b96..ebd145a7bf80 100644 --- a/tests/neg-custom-args/no-experimental/experimentalRHS.scala +++ b/tests/neg/experimentalRHS.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalSam.scala b/tests/neg/experimentalSam.scala similarity index 85% rename from tests/neg-custom-args/no-experimental/experimentalSam.scala rename to tests/neg/experimentalSam.scala index cdc9e61858d9..108a1c633227 100644 --- a/tests/neg-custom-args/no-experimental/experimentalSam.scala +++ b/tests/neg/experimentalSam.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalSignature.scala b/tests/neg/experimentalSignature.scala similarity index 97% rename from tests/neg-custom-args/no-experimental/experimentalSignature.scala rename to tests/neg/experimentalSignature.scala index 9b1d3c5e999f..1307bf31d219 100644 --- a/tests/neg-custom-args/no-experimental/experimentalSignature.scala +++ b/tests/neg/experimentalSignature.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental class A diff --git a/tests/neg-custom-args/no-experimental/experimentalTerms.scala b/tests/neg/experimentalTerms.scala similarity index 95% rename from tests/neg-custom-args/no-experimental/experimentalTerms.scala rename to tests/neg/experimentalTerms.scala index ada5e5b74d2c..e24e35369ca2 100644 --- a/tests/neg-custom-args/no-experimental/experimentalTerms.scala +++ b/tests/neg/experimentalTerms.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalTests.scala b/tests/neg/experimentalTests.scala similarity index 89% rename from tests/neg-custom-args/no-experimental/experimentalTests.scala rename to tests/neg/experimentalTests.scala index f3fbcf8c587c..db90214e9577 100644 --- a/tests/neg-custom-args/no-experimental/experimentalTests.scala +++ b/tests/neg/experimentalTests.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental def x = 2 diff --git a/tests/neg-custom-args/no-experimental/experimentalType.scala b/tests/neg/experimentalType.scala similarity index 90% rename from tests/neg-custom-args/no-experimental/experimentalType.scala rename to tests/neg/experimentalType.scala index f4013788796a..015b3be1f8fa 100644 --- a/tests/neg-custom-args/no-experimental/experimentalType.scala +++ b/tests/neg/experimentalType.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/no-experimental/experimentalTypeRHS.scala b/tests/neg/experimentalTypeRHS.scala similarity index 77% rename from tests/neg-custom-args/no-experimental/experimentalTypeRHS.scala rename to tests/neg/experimentalTypeRHS.scala index 3aaeb960bae9..e902119ead56 100644 --- a/tests/neg-custom-args/no-experimental/experimentalTypeRHS.scala +++ b/tests/neg/experimentalTypeRHS.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental type E diff --git a/tests/neg-custom-args/no-experimental/experimentalTypes2.scala b/tests/neg/experimentalTypes2.scala similarity index 94% rename from tests/neg-custom-args/no-experimental/experimentalTypes2.scala rename to tests/neg/experimentalTypes2.scala index 706fd39fd15c..5ce60d4b2c66 100644 --- a/tests/neg-custom-args/no-experimental/experimentalTypes2.scala +++ b/tests/neg/experimentalTypes2.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental class A diff --git a/tests/neg-custom-args/no-experimental/experimentalUnapply.scala b/tests/neg/experimentalUnapply.scala similarity index 92% rename from tests/neg-custom-args/no-experimental/experimentalUnapply.scala rename to tests/neg/experimentalUnapply.scala index 0ba338a15a96..1fe4a272795e 100644 --- a/tests/neg-custom-args/no-experimental/experimentalUnapply.scala +++ b/tests/neg/experimentalUnapply.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/neg-custom-args/feature/feature-shadowing.scala b/tests/neg/feature-shadowing.scala similarity index 88% rename from tests/neg-custom-args/feature/feature-shadowing.scala rename to tests/neg/feature-shadowing.scala index 270f7c1e12d9..7534f99f73aa 100644 --- a/tests/neg-custom-args/feature/feature-shadowing.scala +++ b/tests/neg/feature-shadowing.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -feature + import language.implicitConversions given Conversion[Int, String] = _.toString diff --git a/tests/neg-custom-args/fatal-warnings/filtering-fors.scala b/tests/neg/filtering-fors.scala similarity index 97% rename from tests/neg-custom-args/fatal-warnings/filtering-fors.scala rename to tests/neg/filtering-fors.scala index df0224a5cea3..b274cf8b06cb 100644 --- a/tests/neg-custom-args/fatal-warnings/filtering-fors.scala +++ b/tests/neg/filtering-fors.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object Test { val xs: List[AnyRef] = ??? diff --git a/tests/neg/gadt-contradictory-pattern.scala b/tests/neg/gadt-contradictory-pattern.scala index 561c0c23d518..89696a65ed4c 100644 --- a/tests/neg/gadt-contradictory-pattern.scala +++ b/tests/neg/gadt-contradictory-pattern.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings object Test { sealed abstract class Foo[T] case object Bar1 extends Foo[Int] diff --git a/tests/neg-custom-args/explain/hidden-type-errors.check b/tests/neg/hidden-type-errors.check similarity index 83% rename from tests/neg-custom-args/explain/hidden-type-errors.check rename to tests/neg/hidden-type-errors.check index 551d1d7b16ba..0cd02fa429a7 100644 --- a/tests/neg-custom-args/explain/hidden-type-errors.check +++ b/tests/neg/hidden-type-errors.check @@ -1,5 +1,5 @@ --- [E007] Type Mismatch Error: tests/neg-custom-args/explain/hidden-type-errors/Test.scala:6:24 ------------------------ -6 | val x = X.doSomething("XXX") // error +-- [E007] Type Mismatch Error: tests/neg/hidden-type-errors/Test.scala:8:24 -------------------------------------------- +8 | val x = X.doSomething("XXX") // error | ^^^^^^^^^^^^^^^^^^^^ | Found: String | Required: Int diff --git a/tests/neg-custom-args/explain/hidden-type-errors/Macro.scala b/tests/neg/hidden-type-errors/Macro.scala similarity index 100% rename from tests/neg-custom-args/explain/hidden-type-errors/Macro.scala rename to tests/neg/hidden-type-errors/Macro.scala diff --git a/tests/neg-custom-args/explain/hidden-type-errors/Test.scala b/tests/neg/hidden-type-errors/Test.scala similarity index 77% rename from tests/neg-custom-args/explain/hidden-type-errors/Test.scala rename to tests/neg/hidden-type-errors/Test.scala index 180aa07cfb50..dabbc5a3cb95 100644 --- a/tests/neg-custom-args/explain/hidden-type-errors/Test.scala +++ b/tests/neg/hidden-type-errors/Test.scala @@ -1,3 +1,5 @@ +// scalac: -explain + package t12717 diff --git a/tests/neg-custom-args/fatal-warnings/i10137.check b/tests/neg/i10137.check similarity index 68% rename from tests/neg-custom-args/fatal-warnings/i10137.check rename to tests/neg/i10137.check index 15361f8dbed2..38fed4a50581 100644 --- a/tests/neg-custom-args/fatal-warnings/i10137.check +++ b/tests/neg/i10137.check @@ -1,9 +1,9 @@ --- Error: tests/neg-custom-args/fatal-warnings/i10137.scala:2:12 ------------------------------------------------------- +-- Error: tests/neg/i10137.scala:2:12 ------------------------------------------------------- 2 | @main def main(): Unit = println("Hello, World!") // error | ^ | The class `foo.main` generated from `@main` will shadow the existing class main in package scala. | The existing definition might no longer be found on recompile. --- Error: tests/neg-custom-args/fatal-warnings/i10137.scala:4:10 ------------------------------------------------------- +-- Error: tests/neg----------------------------------------------- 4 |@main def List(): Unit = println("List") // error | ^ | The class `List` generated from `@main` will shadow the existing type List in package scala. diff --git a/tests/neg-custom-args/deprecation/i10247.scala b/tests/neg/i10247.scala similarity index 93% rename from tests/neg-custom-args/deprecation/i10247.scala rename to tests/neg/i10247.scala index 22601cad8e79..ad38d60f7322 100644 --- a/tests/neg-custom-args/deprecation/i10247.scala +++ b/tests/neg/i10247.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -deprecation + def usered = Color.Red // error: value Red is deprecated object DeprecatedContainer { diff --git a/tests/neg-custom-args/fatal-warnings/i10930.scala b/tests/neg/i10930.scala similarity index 93% rename from tests/neg-custom-args/fatal-warnings/i10930.scala rename to tests/neg/i10930.scala index d1fbdde10574..ba60a15af911 100644 --- a/tests/neg-custom-args/fatal-warnings/i10930.scala +++ b/tests/neg/i10930.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import language.future @main def Test = type LeafElem[X] = X match diff --git a/tests/neg-custom-args/fatal-warnings/i10994.scala b/tests/neg/i10994.scala similarity index 69% rename from tests/neg-custom-args/fatal-warnings/i10994.scala rename to tests/neg/i10994.scala index ce5cb2cf3df9..56d63be8635a 100644 --- a/tests/neg-custom-args/fatal-warnings/i10994.scala +++ b/tests/neg/i10994.scala @@ -1,2 +1,4 @@ +// scalac: -Xfatal-warnings + def foo = true match case (b: Boolean): Boolean => () // error diff --git a/tests/neg/i11022.check b/tests/neg/i11022.check new file mode 100644 index 000000000000..55bdb0526264 --- /dev/null +++ b/tests/neg/i11022.check @@ -0,0 +1,20 @@ +-- Error: tests/neg/i11022.scala:10:7 ---------------------------------------------------------------------------------- +10 |val a: CaseClass = CaseClass(42) // error: deprecated type // error: 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 + | ^^^^^^^^^ + | 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 + | ^^^^^^^^^ + | 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 + | ^^^^^^^^^ + | class CaseClass is deprecated: no CaseClass +-- Error: tests/neg/i11022.scala:12:14 --------------------------------------------------------------------------------- +12 |val c: Unit = CaseClass(42).magic() // error: deprecated apply method + | ^^^^^^^^^ + | class CaseClass is deprecated: no CaseClass diff --git a/tests/neg-custom-args/deprecation/i11022.scala b/tests/neg/i11022.scala similarity index 91% rename from tests/neg-custom-args/deprecation/i11022.scala rename to tests/neg/i11022.scala index 4608017eeed9..a904195f3725 100644 --- a/tests/neg-custom-args/deprecation/i11022.scala +++ b/tests/neg/i11022.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -deprecation + @deprecated("no CaseClass") case class CaseClass(rgb: Int): def magic(): Unit = () diff --git a/tests/neg-custom-args/fatal-warnings/i11097.scala b/tests/neg/i11097.scala similarity index 94% rename from tests/neg-custom-args/fatal-warnings/i11097.scala rename to tests/neg/i11097.scala index 763babff81e2..3a9544a25866 100644 --- a/tests/neg-custom-args/fatal-warnings/i11097.scala +++ b/tests/neg/i11097.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + @main def test: Unit = { class C { type T1; type T2 } diff --git a/tests/neg/i11333.check b/tests/neg/i11333.check new file mode 100644 index 000000000000..ba5723488899 --- /dev/null +++ b/tests/neg/i11333.check @@ -0,0 +1,30 @@ +-- [E167] Lossy Conversion Error: tests/neg/i11333.scala:4:19 ---------------------------------------------------------- +4 | val f1: Float = 123456789 // error + | ^^^^^^^^^ + | 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 + | ^^^^^^^^^^^^^^^^^^^^ + | 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 + | ^^^^^^^^^^ + | 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 + | ^^ + | 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 + | ^^ + | 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 + | ^^ + | Widening conversion from Long to Float loses precision. + | Write `.toFloat` instead. diff --git a/tests/neg-custom-args/fatal-warnings/i11333.scala b/tests/neg/i11333.scala similarity index 92% rename from tests/neg-custom-args/fatal-warnings/i11333.scala rename to tests/neg/i11333.scala index 3ba39efeb29e..c43ddbab6f34 100644 --- a/tests/neg-custom-args/fatal-warnings/i11333.scala +++ b/tests/neg/i11333.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class C: val f1: Float = 123456789 // error val d1: Double = 1234567890123456789L // error diff --git a/tests/neg-custom-args/deprecation/i11344.scala b/tests/neg/i11344.scala similarity index 79% rename from tests/neg-custom-args/deprecation/i11344.scala rename to tests/neg/i11344.scala index 4829b9fcef6b..79e237304ce5 100644 --- a/tests/neg-custom-args/deprecation/i11344.scala +++ b/tests/neg/i11344.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -deprecation + trait Pet(val name: String, rest: Int): def f(suffix: String) = s"$name$suffix$rest" diff --git a/tests/neg-custom-args/explain/i11637.check b/tests/neg/i11637.check similarity index 89% rename from tests/neg-custom-args/explain/i11637.check rename to tests/neg/i11637.check index 82424396a43b..e852649520c8 100644 --- a/tests/neg-custom-args/explain/i11637.check +++ b/tests/neg/i11637.check @@ -1,5 +1,5 @@ --- [E057] Type Mismatch Error: tests/neg-custom-args/explain/i11637.scala:11:33 ---------------------------------------- -11 | var h = new HKT3_1[FunctorImpl](); // error // error +-- [E057] Type Mismatch Error: tests/neg/i11637.scala:13:33 ------------------------------------------------------------ +13 | var h = new HKT3_1[FunctorImpl](); // error // error | ^ | Type argument test2.FunctorImpl does not conform to upper bound [Generic2[T <: String] <: Set[T]] =>> Any |-------------------------------------------------------------------------------------------------------------------- @@ -26,8 +26,8 @@ | | The tests were made under the empty constraint -------------------------------------------------------------------------------------------------------------------- --- [E057] Type Mismatch Error: tests/neg-custom-args/explain/i11637.scala:11:21 ---------------------------------------- -11 | var h = new HKT3_1[FunctorImpl](); // error // error +-- [E057] Type Mismatch Error: tests/neg/i11637.scala:13:21 ------------------------------------------------------------ +13 | var h = new HKT3_1[FunctorImpl](); // error // error | ^ | Type argument test2.FunctorImpl does not conform to upper bound [Generic2[T <: String] <: Set[T]] =>> Any |-------------------------------------------------------------------------------------------------------------------- diff --git a/tests/neg-custom-args/explain/i11637.scala b/tests/neg/i11637.scala similarity index 94% rename from tests/neg-custom-args/explain/i11637.scala rename to tests/neg/i11637.scala index 0b566ecd4328..67af8ec1db07 100644 --- a/tests/neg-custom-args/explain/i11637.scala +++ b/tests/neg/i11637.scala @@ -1,3 +1,5 @@ +// scalac: -explain + // This is OK object test1: class FunctorImpl[Generic1[T] <: Iterable[T]]{} diff --git a/tests/neg/i11963a.scala b/tests/neg/i11963a.scala new file mode 100644 index 000000000000..94f1bf458d51 --- /dev/null +++ b/tests/neg/i11963a.scala @@ -0,0 +1,3 @@ +// scalac: -Xfatal-warnings + +open trait Foo // error diff --git a/tests/neg-custom-args/fatal-warnings/i11963b.scala b/tests/neg/i11963b.scala similarity index 53% rename from tests/neg-custom-args/fatal-warnings/i11963b.scala rename to tests/neg/i11963b.scala index 9fae92747d53..d0741bc4b64a 100644 --- a/tests/neg-custom-args/fatal-warnings/i11963b.scala +++ b/tests/neg/i11963b.scala @@ -1 +1,3 @@ +// scalac: -Xfatal-warnings + open abstract class Foo // error diff --git a/tests/neg-custom-args/fatal-warnings/i11963c.scala b/tests/neg/i11963c.scala similarity index 73% rename from tests/neg-custom-args/fatal-warnings/i11963c.scala rename to tests/neg/i11963c.scala index ebd56e1127c8..c6ba7df590a9 100644 --- a/tests/neg-custom-args/fatal-warnings/i11963c.scala +++ b/tests/neg/i11963c.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object Test { def foo: Any = { open class Bar // error diff --git a/tests/neg-custom-args/fatal-warnings/i12188/Macro.scala b/tests/neg/i12188/Macro.scala similarity index 100% rename from tests/neg-custom-args/fatal-warnings/i12188/Macro.scala rename to tests/neg/i12188/Macro.scala diff --git a/tests/neg-custom-args/fatal-warnings/i12188/Test.scala b/tests/neg/i12188/Test.scala similarity index 86% rename from tests/neg-custom-args/fatal-warnings/i12188/Test.scala rename to tests/neg/i12188/Test.scala index 3bea42ac3032..0d3ca16ccf8d 100644 --- a/tests/neg-custom-args/fatal-warnings/i12188/Test.scala +++ b/tests/neg/i12188/Test.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + sealed trait P case class PC1(a: String) extends P case class PC2(b: Int) extends P diff --git a/tests/neg-custom-args/fatal-warnings/i12253.check b/tests/neg/i12253.check similarity index 55% rename from tests/neg-custom-args/fatal-warnings/i12253.check rename to tests/neg/i12253.check index 654ea9fc8247..74fa3db47b0f 100644 --- a/tests/neg-custom-args/fatal-warnings/i12253.check +++ b/tests/neg/i12253.check @@ -1,9 +1,9 @@ --- Error: tests/neg-custom-args/fatal-warnings/i12253.scala:11:10 ------------------------------------------------------ -11 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // error // error +-- Error: tests/neg/i12253.scala:13:10 --------------------------------------------------------------------------------- +13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // error // error | ^ |the type test for extractors.q2.reflect.Term cannot be checked at runtime because it refers to an abstract type member or type parameter --- Error: tests/neg-custom-args/fatal-warnings/i12253.scala:11:38 ------------------------------------------------------ -11 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // error // error +-- Error: tests/neg/i12253.scala:13:38 --------------------------------------------------------------------------------- +13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // error // error | ^ |the type test for q1.reflect.Select cannot be checked at runtime because it refers to an abstract type member or type parameter there was 1 deprecation warning; re-run with -deprecation for details diff --git a/tests/neg-custom-args/fatal-warnings/i12253.scala b/tests/neg/i12253.scala similarity index 97% rename from tests/neg-custom-args/fatal-warnings/i12253.scala rename to tests/neg/i12253.scala index 88cae0c9f3ec..645f38d527b4 100644 --- a/tests/neg-custom-args/fatal-warnings/i12253.scala +++ b/tests/neg/i12253.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.quoted.{given, *} import deriving.*, compiletime.* diff --git a/tests/neg-custom-args/deprecation/i12597.scala b/tests/neg/i12597.scala similarity index 75% rename from tests/neg-custom-args/deprecation/i12597.scala rename to tests/neg/i12597.scala index 7927dded0cbc..d780bea85bc8 100644 --- a/tests/neg-custom-args/deprecation/i12597.scala +++ b/tests/neg/i12597.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -deprecation + @main def Test = val a: IArray[Int] = IArray(2) val b: IArray[Any] = a diff --git a/tests/neg-custom-args/fatal-warnings/i13011.scala b/tests/neg/i13011.scala similarity index 95% rename from tests/neg-custom-args/fatal-warnings/i13011.scala rename to tests/neg/i13011.scala index ae534394bf96..196ae620a3f9 100644 --- a/tests/neg-custom-args/fatal-warnings/i13011.scala +++ b/tests/neg/i13011.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class i13011 { lazy implicit val simple1: String = simple1 // error def f: Unit = { @@ -11,7 +13,7 @@ class i13011 { lazy val simple4: String = if firstDigitIsEven(22) then this.simple4 else "a" // ok lazy val simple5: String = identity(this.simple5) // error - + lazy val simple6: String = { // error this.simple6 "aa" diff --git a/tests/neg-custom-args/i13026.scala b/tests/neg/i13026.scala similarity index 80% rename from tests/neg-custom-args/i13026.scala rename to tests/neg/i13026.scala index 9ecf909f7122..573f4c96d4db 100644 --- a/tests/neg-custom-args/i13026.scala +++ b/tests/neg/i13026.scala @@ -1,3 +1,5 @@ +// scalac: -print-lines + val x: Int = "not an int" // error val y: Int = "not an int" // error def foo(x: Any) = x.foo // error diff --git a/tests/neg-custom-args/no-experimental/i13091.scala b/tests/neg/i13091.scala similarity index 81% rename from tests/neg-custom-args/no-experimental/i13091.scala rename to tests/neg/i13091.scala index 2b08788ebbc1..e5725258c89d 100644 --- a/tests/neg-custom-args/no-experimental/i13091.scala +++ b/tests/neg/i13091.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental @experimental class Foo diff --git a/tests/neg/i13440.check b/tests/neg/i13440.check new file mode 100644 index 000000000000..c820ee67833d --- /dev/null +++ b/tests/neg/i13440.check @@ -0,0 +1,12 @@ +-- Error: tests/neg/i13440.scala:5:4 ----------------------------------------------------------------------------------- +5 |def given = 42 // error + | ^ + | 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 + | ^ + | 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 + | ^ + | enum is now a keyword, write `enum` instead of enum to keep it as an identifier diff --git a/tests/neg-custom-args/fatal-warnings/i13440.scala b/tests/neg/i13440.scala similarity index 82% rename from tests/neg-custom-args/fatal-warnings/i13440.scala rename to tests/neg/i13440.scala index 6cb4956e7434..629b12bcdc72 100644 --- a/tests/neg-custom-args/fatal-warnings/i13440.scala +++ b/tests/neg/i13440.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import language.`3.0-migration` def given = 42 // error diff --git a/tests/neg-custom-args/fatal-warnings/i13542.scala b/tests/neg/i13542.scala similarity index 97% rename from tests/neg-custom-args/fatal-warnings/i13542.scala rename to tests/neg/i13542.scala index 0ce46313dcad..8d816cbf5fd5 100644 --- a/tests/neg-custom-args/fatal-warnings/i13542.scala +++ b/tests/neg/i13542.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.language.implicitConversions case class Foo(i: Int) extends AnyVal: diff --git a/tests/neg-custom-args/i13838.scala b/tests/neg/i13838.scala similarity index 99% rename from tests/neg-custom-args/i13838.scala rename to tests/neg/i13838.scala index c99d3fa1f82d..3def03bbfd55 100644 --- a/tests/neg-custom-args/i13838.scala +++ b/tests/neg/i13838.scala @@ -1,3 +1,5 @@ +// scalac: -Ximplicit-search-limit 1000 + implicit def catsSyntaxEq[A: Eq](a: A): Foo[A] = ??? class Foo[A] diff --git a/tests/neg-custom-args/no-experimental/i13848.scala b/tests/neg/i13848.scala similarity index 75% rename from tests/neg-custom-args/no-experimental/i13848.scala rename to tests/neg/i13848.scala index 886ab1e85d67..affc0082c2c8 100644 --- a/tests/neg-custom-args/no-experimental/i13848.scala +++ b/tests/neg/i13848.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental @main diff --git a/tests/neg/i13946/BadPrinter.scala b/tests/neg/i13946/BadPrinter.scala new file mode 100644 index 000000000000..de42924e294d --- /dev/null +++ b/tests/neg/i13946/BadPrinter.scala @@ -0,0 +1,6 @@ +// scalac: -Xfatal-warnings -feature + +// in BadPrinter.scala +import language.future +class BadPrinter extends Printer: // error + override def print(s: String): Unit = println("Bad!!!") diff --git a/tests/neg-custom-args/feature/i13946/Printer.scala b/tests/neg/i13946/Printer.scala similarity index 100% rename from tests/neg-custom-args/feature/i13946/Printer.scala rename to tests/neg/i13946/Printer.scala diff --git a/tests/neg-custom-args/fatal-warnings/i14705.scala b/tests/neg/i14705.scala similarity index 66% rename from tests/neg-custom-args/fatal-warnings/i14705.scala rename to tests/neg/i14705.scala index f5c17baae609..489cb9067648 100644 --- a/tests/neg-custom-args/fatal-warnings/i14705.scala +++ b/tests/neg/i14705.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + val n = Nil val b = n.head.isInstanceOf[String] // error diff --git a/tests/neg-custom-args/fatal-warnings/i14721.scala b/tests/neg/i14721.scala similarity index 86% rename from tests/neg-custom-args/fatal-warnings/i14721.scala rename to tests/neg/i14721.scala index 6e884cad22d7..804fe2e13829 100644 --- a/tests/neg-custom-args/fatal-warnings/i14721.scala +++ b/tests/neg/i14721.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings class C: def op: Unit = println("op") diff --git a/tests/neg-custom-args/fatal-warnings/i15474.scala b/tests/neg/i15474.scala similarity index 93% rename from tests/neg-custom-args/fatal-warnings/i15474.scala rename to tests/neg/i15474.scala index 86b01eb28ce6..9d879f886e75 100644 --- a/tests/neg-custom-args/fatal-warnings/i15474.scala +++ b/tests/neg/i15474.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.language.implicitConversions object Test1: diff --git a/tests/neg-custom-args/fatal-warnings/i15503-scala2/scala2-t11681.scala b/tests/neg/i15503-scala2/scala2-t11681.scala similarity index 98% rename from tests/neg-custom-args/fatal-warnings/i15503-scala2/scala2-t11681.scala rename to tests/neg/i15503-scala2/scala2-t11681.scala index 13d540dc2a5d..85f50428a0e6 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503-scala2/scala2-t11681.scala +++ b/tests/neg/i15503-scala2/scala2-t11681.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:params +// scalac: -Xfatal-warnings -Wunused:params // import Answers._ diff --git a/tests/neg-custom-args/fatal-warnings/i15503a.scala b/tests/neg/i15503a.scala similarity index 99% rename from tests/neg-custom-args/fatal-warnings/i15503a.scala rename to tests/neg/i15503a.scala index cd7282490fc9..2dc1fa40f293 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503a.scala +++ b/tests/neg/i15503a.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:imports +// scalac: -Xfatal-warnings -Wunused:imports object FooUnused: diff --git a/tests/neg-custom-args/fatal-warnings/i15503b.scala b/tests/neg/i15503b.scala similarity index 98% rename from tests/neg-custom-args/fatal-warnings/i15503b.scala rename to tests/neg/i15503b.scala index c8a2d6bc2074..4a0728128bc5 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503b.scala +++ b/tests/neg/i15503b.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:locals +// scalac: -Xfatal-warnings -Wunused:locals val a = 1 // OK diff --git a/tests/neg-custom-args/fatal-warnings/i15503c.scala b/tests/neg/i15503c.scala similarity index 96% rename from tests/neg-custom-args/fatal-warnings/i15503c.scala rename to tests/neg/i15503c.scala index e4e15116bf0d..37f88de84aa9 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503c.scala +++ b/tests/neg/i15503c.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:privates +// scalac: -Xfatal-warnings -Wunused:privates trait C class A: self: C => // OK diff --git a/tests/neg-custom-args/fatal-warnings/i15503d.scala b/tests/neg/i15503d.scala similarity index 93% rename from tests/neg-custom-args/fatal-warnings/i15503d.scala rename to tests/neg/i15503d.scala index 6c5973c66a3a..16323e0eb5d2 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503d.scala +++ b/tests/neg/i15503d.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:unsafe-warn-patvars +// scalac: -Xfatal-warnings -Wunused:unsafe-warn-patvars // todo : change to :patvars sealed trait Calc diff --git a/tests/neg-custom-args/fatal-warnings/i15503e.scala b/tests/neg/i15503e.scala similarity index 97% rename from tests/neg-custom-args/fatal-warnings/i15503e.scala rename to tests/neg/i15503e.scala index 57664cd08dcd..3ec8f5e72d06 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503e.scala +++ b/tests/neg/i15503e.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:explicits +// scalac: -Xfatal-warnings -Wunused:explicits object Foo { /* This goes around the "trivial method" detection */ diff --git a/tests/neg-custom-args/fatal-warnings/i15503f.scala b/tests/neg/i15503f.scala similarity index 90% rename from tests/neg-custom-args/fatal-warnings/i15503f.scala rename to tests/neg/i15503f.scala index f909272af732..046b0d634f7a 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503f.scala +++ b/tests/neg/i15503f.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:implicits +// scalac: -Xfatal-warnings -Wunused:implicits /* This goes around the "trivial method" detection */ val default_int = 1 diff --git a/tests/neg-custom-args/fatal-warnings/i15503g.scala b/tests/neg/i15503g.scala similarity index 93% rename from tests/neg-custom-args/fatal-warnings/i15503g.scala rename to tests/neg/i15503g.scala index 2185bfed711d..f77ef4cd49dc 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503g.scala +++ b/tests/neg/i15503g.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:params +// scalac: -Xfatal-warnings -Wunused:params /* This goes around the "trivial method" detection */ object Foo { diff --git a/tests/neg-custom-args/fatal-warnings/i15503h.scala b/tests/neg/i15503h.scala similarity index 88% rename from tests/neg-custom-args/fatal-warnings/i15503h.scala rename to tests/neg/i15503h.scala index 3bab6cdbd098..c7719fa4d26f 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503h.scala +++ b/tests/neg/i15503h.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:linted +// scalac: -Xfatal-warnings -Wunused:linted import collection.mutable.Set // error diff --git a/tests/neg-custom-args/fatal-warnings/i15503i.scala b/tests/neg/i15503i.scala similarity index 99% rename from tests/neg-custom-args/fatal-warnings/i15503i.scala rename to tests/neg/i15503i.scala index ea84c176eee4..ca0bb2cf1714 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503i.scala +++ b/tests/neg/i15503i.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:all +// scalac: -Xfatal-warnings -Wunused:all import collection.mutable.{Map => MutMap} // error import collection.mutable.Set // error @@ -299,7 +299,7 @@ package foo.test.i17175: } { println(i) } - + package foo.test.i17117: package example { object test1 { diff --git a/tests/neg-custom-args/fatal-warnings/i15503j.scala b/tests/neg/i15503j.scala similarity index 95% rename from tests/neg-custom-args/fatal-warnings/i15503j.scala rename to tests/neg/i15503j.scala index 51c1fa6fda0c..d00e2bf7fac2 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503j.scala +++ b/tests/neg/i15503j.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:strict-no-implicit-warn +// scalac: -Xfatal-warnings -Wunused:strict-no-implicit-warn package foo.unused.strict.test: package a: diff --git a/tests/neg-custom-args/explain/i15575.check b/tests/neg/i15575.check similarity index 83% rename from tests/neg-custom-args/explain/i15575.check rename to tests/neg/i15575.check index e254e0a5e22e..b4a5e3f53d84 100644 --- a/tests/neg-custom-args/explain/i15575.check +++ b/tests/neg/i15575.check @@ -1,5 +1,5 @@ --- [E057] Type Mismatch Error: tests/neg-custom-args/explain/i15575.scala:3:27 ----------------------------------------- -3 | def bar[T]: Unit = foo[T & Any] // error +-- [E057] Type Mismatch Error: tests/neg/i15575.scala:5:27 ------------------------------------------------------------- +5 | def bar[T]: Unit = foo[T & Any] // error | ^ | Type argument T & Any does not conform to lower bound Any |--------------------------------------------------------------------------------------------------------------------- @@ -18,8 +18,8 @@ | | The tests were made under the empty constraint --------------------------------------------------------------------------------------------------------------------- --- [E057] Type Mismatch Error: tests/neg-custom-args/explain/i15575.scala:7:14 ----------------------------------------- -7 | val _ = foo[String] // error +-- [E057] Type Mismatch Error: tests/neg/i15575.scala:9:14 ------------------------------------------------------------- +9 | val _ = foo[String] // error | ^ | Type argument String does not conform to lower bound CharSequence |--------------------------------------------------------------------------------------------------------------------- diff --git a/tests/neg-custom-args/explain/i15575.scala b/tests/neg/i15575.scala similarity index 89% rename from tests/neg-custom-args/explain/i15575.scala rename to tests/neg/i15575.scala index 367d0f36f1ed..b26d17369873 100644 --- a/tests/neg-custom-args/explain/i15575.scala +++ b/tests/neg/i15575.scala @@ -1,3 +1,5 @@ +// scalac: -explain + object Test1: def foo[T >: Any]: Unit = () def bar[T]: Unit = foo[T & Any] // error diff --git a/tests/neg-custom-args/fatal-warnings/i15662.scala b/tests/neg/i15662.scala similarity index 92% rename from tests/neg-custom-args/fatal-warnings/i15662.scala rename to tests/neg/i15662.scala index afe505922603..e3030f6adc0e 100644 --- a/tests/neg-custom-args/fatal-warnings/i15662.scala +++ b/tests/neg/i15662.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + case class Composite[T](v: T) def m(composite: Composite[_]): Unit = diff --git a/tests/neg-custom-args/fatal-warnings/i15893.scala b/tests/neg/i15893.scala similarity index 98% rename from tests/neg-custom-args/fatal-warnings/i15893.scala rename to tests/neg/i15893.scala index f23e6150106a..98973c334bdc 100644 --- a/tests/neg-custom-args/fatal-warnings/i15893.scala +++ b/tests/neg/i15893.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + sealed trait NatT case class Zero() extends NatT case class Succ[+N <: NatT](n: N) extends NatT diff --git a/tests/neg-custom-args/explain/i16601a.check b/tests/neg/i16601a.check similarity index 83% rename from tests/neg-custom-args/explain/i16601a.check rename to tests/neg/i16601a.check index 63be0d2cd2b2..f6ddd66ca107 100644 --- a/tests/neg-custom-args/explain/i16601a.check +++ b/tests/neg/i16601a.check @@ -1,5 +1,5 @@ --- [E042] Type Error: tests/neg-custom-args/explain/i16601a.scala:1:27 ------------------------------------------------- -1 |@main def Test: Unit = new concurrent.ExecutionContext // error +-- [E042] Type Error: tests/neg/i16601a.scala:3:27 --------------------------------------------------------------------- +3 |@main def Test: Unit = new concurrent.ExecutionContext // error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ExecutionContext is a trait; it cannot be instantiated |--------------------------------------------------------------------------------------------------------------------- diff --git a/tests/neg-custom-args/explain/i16601a.scala b/tests/neg/i16601a.scala similarity index 75% rename from tests/neg-custom-args/explain/i16601a.scala rename to tests/neg/i16601a.scala index 2e058db0093c..ab785ce14de2 100644 --- a/tests/neg-custom-args/explain/i16601a.scala +++ b/tests/neg/i16601a.scala @@ -1 +1,3 @@ +// scalac: -explain + @main def Test: Unit = new concurrent.ExecutionContext // error \ No newline at end of file diff --git a/tests/neg-custom-args/fatal-warnings/i16639a.scala b/tests/neg/i16639a.scala similarity index 99% rename from tests/neg-custom-args/fatal-warnings/i16639a.scala rename to tests/neg/i16639a.scala index c62910b7f566..b45c11c412be 100644 --- a/tests/neg-custom-args/fatal-warnings/i16639a.scala +++ b/tests/neg/i16639a.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:all +// scalac: -Xfatal-warnings -Wunused:all // class Bippy(a: Int, b: Int) { private def this(c: Int) = this(c, c) // warn /Dotty:NoWarn diff --git a/tests/neg-custom-args/fatal-warnings/i16649-refutable.check b/tests/neg/i16649-refutable.check similarity index 67% rename from tests/neg-custom-args/fatal-warnings/i16649-refutable.check rename to tests/neg/i16649-refutable.check index 5b3d460c7f09..a1325d7cfa91 100644 --- a/tests/neg-custom-args/fatal-warnings/i16649-refutable.check +++ b/tests/neg/i16649-refutable.check @@ -1,5 +1,5 @@ --- Error: tests/neg-custom-args/fatal-warnings/i16649-refutable.scala:4:6 ---------------------------------------------- -4 | val '{ ($y: Int) + ($z: Int) } = x // error +-- Error: tests/neg/i16649-refutable.scala:6:6 ------------------------------------------------------------------------- +6 | val '{ ($y: Int) + ($z: Int) } = x // error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | pattern binding uses refutable extractor `'{...}` | diff --git a/tests/neg-custom-args/fatal-warnings/i16649-refutable.scala b/tests/neg/i16649-refutable.scala similarity index 52% rename from tests/neg-custom-args/fatal-warnings/i16649-refutable.scala rename to tests/neg/i16649-refutable.scala index 2a42f652e093..f6e649c624ef 100644 --- a/tests/neg-custom-args/fatal-warnings/i16649-refutable.scala +++ b/tests/neg/i16649-refutable.scala @@ -1,4 +1,9 @@ +// scalac: -Xfatal-warnings + import quoted.* def foo(using Quotes)(x: Expr[Int]) = val '{ ($y: Int) + ($z: Int) } = x // error + val '{ $a: Int } = x + val '{ $b: Any } = x + val '{ $c } = x diff --git a/tests/neg/i16728.check b/tests/neg/i16728.check new file mode 100644 index 000000000000..9bc8b7457ce2 --- /dev/null +++ b/tests/neg/i16728.check @@ -0,0 +1,4 @@ +-- Error: tests/neg/i16728.scala:18:11 --------------------------------------------------------------------------------- +18 | case tx : C[Int]#X => // error + | ^ + | the type test for C[Int] cannot be checked at runtime because its type arguments can't be determined from A diff --git a/tests/neg-custom-args/fatal-warnings/i16728.scala b/tests/neg/i16728.scala similarity index 94% rename from tests/neg-custom-args/fatal-warnings/i16728.scala rename to tests/neg/i16728.scala index 42c860cc40b2..d79ba16b3954 100644 --- a/tests/neg-custom-args/fatal-warnings/i16728.scala +++ b/tests/neg/i16728.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class A[T] { class X { def outer : A.this.type = A.this diff --git a/tests/neg-custom-args/fatal-warnings/i16876/Macro.scala b/tests/neg/i16876/Macro.scala similarity index 100% rename from tests/neg-custom-args/fatal-warnings/i16876/Macro.scala rename to tests/neg/i16876/Macro.scala diff --git a/tests/neg-custom-args/fatal-warnings/i16876/Test.scala b/tests/neg/i16876/Test.scala similarity index 83% rename from tests/neg-custom-args/fatal-warnings/i16876/Test.scala rename to tests/neg/i16876/Test.scala index d9229d31cd6d..ea8f46909db5 100644 --- a/tests/neg-custom-args/fatal-warnings/i16876/Test.scala +++ b/tests/neg/i16876/Test.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:all +// scalac: -Xfatal-warnings -Wunused:all object Foo { private def myMethod(a: Int, b: Int, c: Int) = adder // ok diff --git a/tests/neg-custom-args/explain/i16888.check b/tests/neg/i16888.check similarity index 84% rename from tests/neg-custom-args/explain/i16888.check rename to tests/neg/i16888.check index a5c02e961d3c..3f050fe5cc2d 100644 --- a/tests/neg-custom-args/explain/i16888.check +++ b/tests/neg/i16888.check @@ -1,5 +1,5 @@ --- [E172] Type Error: tests/neg-custom-args/explain/i16888.scala:1:38 -------------------------------------------------- -1 |def test = summon[scala.quoted.Quotes] // error +-- [E172] Type Error: tests/neg/i16888.scala:3:38 ---------------------------------------------------------------------- +3 |def test = summon[scala.quoted.Quotes] // error | ^ | No given instance of type scala.quoted.Quotes was found for parameter x of method summon in object Predef |--------------------------------------------------------------------------------------------------------------------- diff --git a/tests/neg-custom-args/explain/i16888.scala b/tests/neg/i16888.scala similarity index 69% rename from tests/neg-custom-args/explain/i16888.scala rename to tests/neg/i16888.scala index 9d3fd0f2f57e..8b4e94eb58da 100644 --- a/tests/neg-custom-args/explain/i16888.scala +++ b/tests/neg/i16888.scala @@ -1 +1,3 @@ +// scalac: -explain + def test = summon[scala.quoted.Quotes] // error diff --git a/tests/neg-custom-args/fatal-warnings/i16930.scala b/tests/neg/i16930.scala similarity index 90% rename from tests/neg-custom-args/fatal-warnings/i16930.scala rename to tests/neg/i16930.scala index 1f6c5bf1a09f..816fba7f4dcf 100644 --- a/tests/neg-custom-args/fatal-warnings/i16930.scala +++ b/tests/neg/i16930.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:imports +// scalac: -Xfatal-warnings -Wunused:imports trait Outer: trait Used diff --git a/tests/neg-custom-args/no-experimental/i17292.scala b/tests/neg/i17292.scala similarity index 83% rename from tests/neg-custom-args/no-experimental/i17292.scala rename to tests/neg/i17292.scala index 381d252dbea8..fdab30779cdb 100644 --- a/tests/neg-custom-args/no-experimental/i17292.scala +++ b/tests/neg/i17292.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental class Foo { @experimental type Bar = (Int, String) } diff --git a/tests/neg-custom-args/no-experimental/i17292b.scala b/tests/neg/i17292b.scala similarity index 94% rename from tests/neg-custom-args/no-experimental/i17292b.scala rename to tests/neg/i17292b.scala index f644dd60ecd5..2111001e28f9 100644 --- a/tests/neg-custom-args/no-experimental/i17292b.scala +++ b/tests/neg/i17292b.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental type A[T] = Int class Foo { diff --git a/tests/neg-custom-args/fatal-warnings/i17314b.scala b/tests/neg/i17314b.scala similarity index 83% rename from tests/neg-custom-args/fatal-warnings/i17314b.scala rename to tests/neg/i17314b.scala index 384767765cf4..f1eb82865c3b 100644 --- a/tests/neg-custom-args/fatal-warnings/i17314b.scala +++ b/tests/neg/i17314b.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:all +// scalac: -Xfatal-warnings -Wunused:all package foo: class Foo[T] diff --git a/tests/neg-custom-args/fatal-warnings/i17335.scala b/tests/neg/i17335.scala similarity index 54% rename from tests/neg-custom-args/fatal-warnings/i17335.scala rename to tests/neg/i17335.scala index 6629e2f151c9..8dd4d90721f2 100644 --- a/tests/neg-custom-args/fatal-warnings/i17335.scala +++ b/tests/neg/i17335.scala @@ -1,4 +1,4 @@ -// scalac: -Wunused:all +// scalac: -Xfatal-warnings -Wunused:all def aMethod() = doStuff { (x) => x } // error diff --git a/tests/neg-custom-args/deprecation/i2333.scala b/tests/neg/i2333.scala similarity index 79% rename from tests/neg-custom-args/deprecation/i2333.scala rename to tests/neg/i2333.scala index a22433394346..92def60e6fe4 100644 --- a/tests/neg-custom-args/deprecation/i2333.scala +++ b/tests/neg/i2333.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -deprecation + @deprecated("bla", "2.11.0") class Foo { println("") def this(x: Int) = this() diff --git a/tests/neg-custom-args/erased/i2642.scala b/tests/neg/i2642.scala similarity index 88% rename from tests/neg-custom-args/erased/i2642.scala rename to tests/neg/i2642.scala index fdb73e215d52..c3fe2a680bdc 100644 --- a/tests/neg-custom-args/erased/i2642.scala +++ b/tests/neg/i2642.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Foo { type X = (using ) => Int // error: an identifier expected, but ')' found def ff: X = () // error: found: Unit, expected: Int diff --git a/tests/neg-custom-args/fatal-warnings/i2673.scala b/tests/neg/i2673.scala similarity index 59% rename from tests/neg-custom-args/fatal-warnings/i2673.scala rename to tests/neg/i2673.scala index 2cb4fb03874e..2d017fe7c02d 100644 --- a/tests/neg-custom-args/fatal-warnings/i2673.scala +++ b/tests/neg/i2673.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + package Foos class Foo // error diff --git a/tests/neg-custom-args/fatal-warnings/i2673b.scala b/tests/neg/i2673b.scala similarity index 60% rename from tests/neg-custom-args/fatal-warnings/i2673b.scala rename to tests/neg/i2673b.scala index e3c29d6bc8d0..8d5ea8491a6c 100644 --- a/tests/neg-custom-args/fatal-warnings/i2673b.scala +++ b/tests/neg/i2673b.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + package Foos class Bar // error diff --git a/tests/neg-custom-args/fatal-warnings/i2673c.scala b/tests/neg/i2673c.scala similarity index 70% rename from tests/neg-custom-args/fatal-warnings/i2673c.scala rename to tests/neg/i2673c.scala index a677fab3081d..f8f1786cd9f6 100644 --- a/tests/neg-custom-args/fatal-warnings/i2673c.scala +++ b/tests/neg/i2673c.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + package Foos object Outer { diff --git a/tests/neg-custom-args/i3246.scala b/tests/neg/i3246.scala similarity index 72% rename from tests/neg-custom-args/i3246.scala rename to tests/neg/i3246.scala index dc22c33ac2f8..2c4261317730 100644 --- a/tests/neg-custom-args/i3246.scala +++ b/tests/neg/i3246.scala @@ -1,3 +1,5 @@ +// scalac: -source 3.0-migration + class Test { def foo(x: Int) = 1 val bar: () => Int = foo _ // error: type mismatch diff --git a/tests/neg-custom-args/fatal-warnings/i3561.scala b/tests/neg/i3561.scala similarity index 93% rename from tests/neg-custom-args/fatal-warnings/i3561.scala rename to tests/neg/i3561.scala index f6e754e9ec8c..2f87bfa0288a 100644 --- a/tests/neg-custom-args/fatal-warnings/i3561.scala +++ b/tests/neg/i3561.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class Test { val Constant = 'Q' // OK if final def tokenMe(ch: Char) = (ch: @annotation.switch) match { // error: could not emit switch diff --git a/tests/neg-custom-args/fatal-warnings/i4008.check b/tests/neg/i4008.check similarity index 56% rename from tests/neg-custom-args/fatal-warnings/i4008.check rename to tests/neg/i4008.check index a6e206f623d7..c1f27866d1c1 100644 --- a/tests/neg-custom-args/fatal-warnings/i4008.check +++ b/tests/neg/i4008.check @@ -1,40 +1,40 @@ --- [E158] Reference Error: tests/neg-custom-args/fatal-warnings/i4008.scala:5:56 --------------------------------------- -5 |@annotation.implicitNotFound("An implicit ShouldWarn1[${B}] is not in scope") // error +-- [E158] Reference Error: tests/neg/i4008.scala:7:56 ------------------------------------------------------------------ +7 |@annotation.implicitNotFound("An implicit ShouldWarn1[${B}] is not in scope") // error | ^ | 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-custom-args/fatal-warnings/i4008.scala:9:56 --------------------------------------- -9 |@annotation.implicitNotFound("An implicit ShouldWarn2[${A}] is not in scope") // error - | ^ - | 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-custom-args/fatal-warnings/i4008.scala:13:56 -------------------------------------- -13 |@annotation.implicitNotFound("An implicit ShouldWarn3[${A},${B}] is not in scope") // error +-- [E158] Reference Error: tests/neg/i4008.scala:11:56 ----------------------------------------------------------------- +11 |@annotation.implicitNotFound("An implicit ShouldWarn2[${A}] is not in scope") // error + | ^ + | 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 | ^ | 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-custom-args/fatal-warnings/i4008.scala:17:56 -------------------------------------- -17 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // error // error +-- [E158] Reference Error: tests/neg/i4008.scala:19:56 ----------------------------------------------------------------- +19 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // error // error | ^ | 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-custom-args/fatal-warnings/i4008.scala:17:61 -------------------------------------- -17 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // error // error +-- [E158] Reference Error: tests/neg/i4008.scala:19:61 ----------------------------------------------------------------- +19 |@annotation.implicitNotFound("An implicit ShouldWarn4[${A},${B}] is not in scope") // error // error | ^ | 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-custom-args/fatal-warnings/i4008.scala:21:61 -------------------------------------- -21 |@annotation.implicitNotFound("An implicit ShouldWarn5[${C},${Abc}] is not in scope") // error +-- [E158] Reference Error: tests/neg/i4008.scala:23:61 ----------------------------------------------------------------- +23 |@annotation.implicitNotFound("An implicit ShouldWarn5[${C},${Abc}] is not in scope") // error | ^ | 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-custom-args/fatal-warnings/i4008.scala:44:54 -------------------------------------- -44 |class C[A](using @annotation.implicitNotFound("No C[${B}] found") c: Class[A]) // error +-- [E158] Reference Error: tests/neg/i4008.scala:46:54 ----------------------------------------------------------------- +46 |class C[A](using @annotation.implicitNotFound("No C[${B}] found") c: Class[A]) // error | ^ | 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-custom-args/fatal-warnings/i4008.scala:46:62 -------------------------------------- -46 |def someMethod1[A](using @annotation.implicitNotFound("No C[${B}] found") sc: C[A]) = 0 // error +-- [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 | ^ | 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`. diff --git a/tests/neg-custom-args/fatal-warnings/i4008.scala b/tests/neg/i4008.scala similarity index 98% rename from tests/neg-custom-args/fatal-warnings/i4008.scala rename to tests/neg/i4008.scala index e6e46dc83a78..5b5464a7a40a 100644 --- a/tests/neg-custom-args/fatal-warnings/i4008.scala +++ b/tests/neg/i4008.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + // ===== Template annotations ===== diff --git a/tests/neg-custom-args/erased/i4060.scala b/tests/neg/i4060.scala similarity index 93% rename from tests/neg-custom-args/erased/i4060.scala rename to tests/neg/i4060.scala index a1a2eee68dc0..6d467d414666 100644 --- a/tests/neg-custom-args/erased/i4060.scala +++ b/tests/neg/i4060.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + // See https://github.com/lampepfl/dotty/issues/4060#issuecomment-445808377 object App { diff --git a/tests/neg-custom-args/fatal-warnings/i4364.scala b/tests/neg/i4364.scala similarity index 90% rename from tests/neg-custom-args/fatal-warnings/i4364.scala rename to tests/neg/i4364.scala index 5ec3f9cd169d..ed47c41eec40 100644 --- a/tests/neg-custom-args/fatal-warnings/i4364.scala +++ b/tests/neg/i4364.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object Test { def foo(c: java.util.function.Consumer[Integer]) = c.accept(0) def f(x: Int): Unit = () diff --git a/tests/neg/i4936b.scala b/tests/neg/i4936b.scala new file mode 100644 index 000000000000..33b13c1eeec1 --- /dev/null +++ b/tests/neg/i4936b.scala @@ -0,0 +1,3 @@ +// scalac: -Xfatal-warnings + +final object Foo // error diff --git a/tests/neg-custom-args/fatal-warnings/i4986b.check b/tests/neg/i4986b.check similarity index 59% rename from tests/neg-custom-args/fatal-warnings/i4986b.check rename to tests/neg/i4986b.check index 2e74c29b077c..db30dcba8003 100644 --- a/tests/neg-custom-args/fatal-warnings/i4986b.check +++ b/tests/neg/i4986b.check @@ -1,40 +1,40 @@ --- [E158] Reference Error: tests/neg-custom-args/fatal-warnings/i4986b.scala:3:65 -------------------------------------- -3 |@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 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 | ^ | 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-custom-args/fatal-warnings/i4986b.scala:3:94 -------------------------------------- -3 |@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 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 | ^ | 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-custom-args/fatal-warnings/i4986b.scala:6:71 -------------------------------------- -6 |@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.") // error +-- [E158] Reference Error: tests/neg/i4986b.scala:8:71 ----------------------------------------------------------------- +8 |@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.") // error | ^ | 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-custom-args/fatal-warnings/i4986b.scala:9:46 -------------------------------------- -9 |class C[T](implicit @implicitNotFound("No C[${t}] available") t: T) // error - | ^ - | 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-custom-args/fatal-warnings/i4986b.scala:12:54 ------------------------------------- -12 | def m[Aaa](implicit @implicitNotFound("I see no C[${Uuh}]") theC: C[Aaa]) = ??? // error +-- [E158] Reference Error: tests/neg/i4986b.scala:11:46 ---------------------------------------------------------------- +11 |class C[T](implicit @implicitNotFound("No C[${t}] available") t: T) // error + | ^ + | 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 | ^ | 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-custom-args/fatal-warnings/i4986b.scala:18:73 ------------------------------------- -18 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // error // error // error +-- [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 | ^ | 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-custom-args/fatal-warnings/i4986b.scala:18:79 ------------------------------------- -18 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // error // error // error +-- [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 | ^ | 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-custom-args/fatal-warnings/i4986b.scala:18:86 ------------------------------------- -18 | def m[S](implicit @implicitNotFound("${X} ${Y} ${ Z } ${R} ${S} -- ${XX} ${ZZ} ${ Nix }") i: Int) = ??? // error // error // error +-- [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 | ^ | 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`. diff --git a/tests/neg-custom-args/fatal-warnings/i4986b.scala b/tests/neg/i4986b.scala similarity index 96% rename from tests/neg-custom-args/fatal-warnings/i4986b.scala rename to tests/neg/i4986b.scala index e4ee1e64e8fe..a563e0b43991 100644 --- a/tests/neg-custom-args/fatal-warnings/i4986b.scala +++ b/tests/neg/i4986b.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + 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 diff --git a/tests/neg-custom-args/fatal-warnings/i4986d.scala b/tests/neg/i4986d.scala similarity index 94% rename from tests/neg-custom-args/fatal-warnings/i4986d.scala rename to tests/neg/i4986d.scala index 74a3c01aaa71..47769efd46ba 100644 --- a/tests/neg-custom-args/fatal-warnings/i4986d.scala +++ b/tests/neg/i4986d.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + trait Foo[A] type Fooable[A] = { diff --git a/tests/neg-custom-args/fatal-warnings/i5013.scala b/tests/neg/i5013.scala similarity index 90% rename from tests/neg-custom-args/fatal-warnings/i5013.scala rename to tests/neg/i5013.scala index 3581810259e9..a6987b457147 100644 --- a/tests/neg-custom-args/fatal-warnings/i5013.scala +++ b/tests/neg/i5013.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class Foo { def foo1: Unit = 2 // error: A pure expression does nothing in statement position diff --git a/tests/neg-custom-args/fatal-warnings/i5013b.scala b/tests/neg/i5013b.scala similarity index 90% rename from tests/neg-custom-args/fatal-warnings/i5013b.scala rename to tests/neg/i5013b.scala index 309c153e2ea3..554ec7417ef9 100644 --- a/tests/neg-custom-args/fatal-warnings/i5013b.scala +++ b/tests/neg/i5013b.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class Foo { val a: Int = 3 diff --git a/tests/neg/i5077.scala b/tests/neg/i5077.scala index bcae42b6a5c5..5f8c48aa717c 100644 --- a/tests/neg/i5077.scala +++ b/tests/neg/i5077.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings trait Is[A] case object IsInt extends Is[Int] case object IsString extends Is[String] diff --git a/tests/neg-custom-args/erased/i5525.scala b/tests/neg/i5525b.scala similarity index 84% rename from tests/neg-custom-args/erased/i5525.scala rename to tests/neg/i5525b.scala index abf8488bd38b..6b8295c397bb 100644 --- a/tests/neg-custom-args/erased/i5525.scala +++ b/tests/neg/i5525b.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + erased enum Foo6 {} // error: only access modifiers allowed enum Foo10 { // error: Enumerations must contain at least one case diff --git a/tests/neg-custom-args/fatal-warnings/i6190a.check b/tests/neg/i6190a.check similarity index 100% rename from tests/neg-custom-args/fatal-warnings/i6190a.check rename to tests/neg/i6190a.check diff --git a/tests/neg/i6190b.check b/tests/neg/i6190b.check new file mode 100644 index 000000000000..5d4dbd7c24cb --- /dev/null +++ b/tests/neg/i6190b.check @@ -0,0 +1,4 @@ +-- Error: tests/neg/i6190b.scala:5:29 ---------------------------------------------------------------------------------- +5 |def foo = List("1", "2").map(Rule) // error + | ^^^^ + | The method `apply` is inserted. The auto insertion will be deprecated, please write `Rule.apply` explicitly. diff --git a/tests/neg-custom-args/fatal-warnings/i6190b.scala b/tests/neg/i6190b.scala similarity index 72% rename from tests/neg-custom-args/fatal-warnings/i6190b.scala rename to tests/neg/i6190b.scala index 470757791078..00ad4dfd920b 100644 --- a/tests/neg-custom-args/fatal-warnings/i6190b.scala +++ b/tests/neg/i6190b.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + case class Rule(name: String) def foo = List("1", "2").map(Rule) // error diff --git a/tests/neg/i6795.check b/tests/neg/i6795.check new file mode 100644 index 000000000000..3dac666927a6 --- /dev/null +++ b/tests/neg/i6795.check @@ -0,0 +1,4 @@ +-- Error: tests/neg/erased/i6795.scala:1:13 ---------------------------------------------------------------- +1 |erased class Foo // error + |^^^^^^^^^^^^^^^^ + |modifier(s) `erased` incompatible with type definition diff --git a/tests/neg-custom-args/i7314.scala b/tests/neg/i7314.scala similarity index 85% rename from tests/neg-custom-args/i7314.scala rename to tests/neg/i7314.scala index fbdf3dfc477f..b68a7bebc080 100644 --- a/tests/neg-custom-args/i7314.scala +++ b/tests/neg/i7314.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -source future + @main def Test = // conversion out of the opaque type: val imm1 = IArray(1,2,3) // supposedly immutable diff --git a/tests/neg-custom-args/fatal-warnings/i7821.scala b/tests/neg/i7821.scala similarity index 94% rename from tests/neg-custom-args/fatal-warnings/i7821.scala rename to tests/neg/i7821.scala index 1574801826bc..71619a2342b5 100644 --- a/tests/neg-custom-args/fatal-warnings/i7821.scala +++ b/tests/neg/i7821.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object XObject { opaque type X = Int diff --git a/tests/neg-custom-args/fatal-warnings/i7821b.scala b/tests/neg/i7821b.scala similarity index 93% rename from tests/neg-custom-args/fatal-warnings/i7821b.scala rename to tests/neg/i7821b.scala index 9e38b33b0cb3..d4d562509e63 100644 --- a/tests/neg-custom-args/fatal-warnings/i7821b.scala +++ b/tests/neg/i7821b.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object Test { { def f(x: Int, y: Int): Int = f(x, y) } // error diff --git a/tests/neg-custom-args/fatal-warnings/i8427.scala b/tests/neg/i8427.scala similarity index 83% rename from tests/neg-custom-args/fatal-warnings/i8427.scala rename to tests/neg/i8427.scala index a5bdd68567c1..03176269c62b 100644 --- a/tests/neg-custom-args/fatal-warnings/i8427.scala +++ b/tests/neg/i8427.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + @SerialVersionUID(1L) // error trait T diff --git a/tests/neg-custom-args/fatal-warnings/i8681.scala b/tests/neg/i8681.scala similarity index 91% rename from tests/neg-custom-args/fatal-warnings/i8681.scala rename to tests/neg/i8681.scala index c45b15ac3bf8..8531240d4ebe 100644 --- a/tests/neg-custom-args/fatal-warnings/i8681.scala +++ b/tests/neg/i8681.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + case class A(a: Int) case class B(b: Int) case class C(c: Int) diff --git a/tests/neg/i8711.check b/tests/neg/i8711.check new file mode 100644 index 000000000000..5dbeeb22460c --- /dev/null +++ b/tests/neg/i8711.check @@ -0,0 +1,12 @@ +-- [E030] Match case Unreachable 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 + | ^^^^ + | Unreachable case +-- [E030] Match case Unreachable Error: 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 + | ^^^^^^^^^^ + | Unreachable case diff --git a/tests/neg-custom-args/fatal-warnings/i8711.scala b/tests/neg/i8711.scala similarity index 92% rename from tests/neg-custom-args/fatal-warnings/i8711.scala rename to tests/neg/i8711.scala index 46fc5a85c90a..10a02ee402c6 100644 --- a/tests/neg-custom-args/fatal-warnings/i8711.scala +++ b/tests/neg/i8711.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class A class B class C diff --git a/tests/neg-custom-args/fatal-warnings/i8781b.scala b/tests/neg/i8781b.scala similarity index 79% rename from tests/neg-custom-args/fatal-warnings/i8781b.scala rename to tests/neg/i8781b.scala index a30b0e5249c9..0cb800ecdbc7 100644 --- a/tests/neg-custom-args/fatal-warnings/i8781b.scala +++ b/tests/neg/i8781b.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object Test: println((3: Boolean | Int).isInstanceOf[Boolean]) diff --git a/tests/neg-custom-args/fatal-warnings/i8922b.scala b/tests/neg/i8922b.scala similarity index 99% rename from tests/neg-custom-args/fatal-warnings/i8922b.scala rename to tests/neg/i8922b.scala index 39b0bbedc9e3..b3c0bcadd73f 100644 --- a/tests/neg-custom-args/fatal-warnings/i8922b.scala +++ b/tests/neg/i8922b.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + case class Token(tokenType: TokenType, lexeme: StringV, line: IntV) sealed trait TokenType diff --git a/tests/neg/i9166.scala b/tests/neg/i9166.scala index 7bbf2871eed3..f1b38ab14d1a 100644 --- a/tests/neg/i9166.scala +++ b/tests/neg/i9166.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings object UnitTest extends App { def foo(m: Unit) = m match { case runtime.BoxedUnit.UNIT => println("ok") // error diff --git a/tests/neg-custom-args/fatal-warnings/i9168.scala b/tests/neg/i9168.scala similarity index 57% rename from tests/neg-custom-args/fatal-warnings/i9168.scala rename to tests/neg/i9168.scala index 59263239f378..8d90e2d2a0e7 100644 --- a/tests/neg-custom-args/fatal-warnings/i9168.scala +++ b/tests/neg/i9168.scala @@ -1 +1,3 @@ +// scalac: -Xfatal-warnings + def g: Int = try 42 finally ; // error diff --git a/tests/neg-custom-args/fatal-warnings/i9241.scala b/tests/neg/i9241.scala similarity index 97% rename from tests/neg-custom-args/fatal-warnings/i9241.scala rename to tests/neg/i9241.scala index d3be9bc9278d..fe8cc22d8b96 100644 --- a/tests/neg-custom-args/fatal-warnings/i9241.scala +++ b/tests/neg/i9241.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class Foo { def unary_~() : Foo = this // error def unary_-(using Int)(): Foo = this // error diff --git a/tests/neg-custom-args/fatal-warnings/i9266.check b/tests/neg/i9266.check similarity index 71% rename from tests/neg-custom-args/fatal-warnings/i9266.check rename to tests/neg/i9266.check index 849aed5fa2e0..bd80a017da02 100644 --- a/tests/neg-custom-args/fatal-warnings/i9266.check +++ b/tests/neg/i9266.check @@ -1,5 +1,5 @@ --- Error: tests/neg-custom-args/fatal-warnings/i9266.scala:3:22 -------------------------------------------------------- -3 |def test = { implicit x: Int => x + x } // error +-- Error: tests/neg/i9266.scala:5:22 ----------------------------------------------------------------------------------- +5 |def test = { implicit x: Int => x + x } // error | ^ | This syntax is no longer supported; parameter needs to be enclosed in (...) | This construct can be rewritten automatically under -rewrite -source future-migration. diff --git a/tests/neg-custom-args/fatal-warnings/i9266.scala b/tests/neg/i9266.scala similarity index 74% rename from tests/neg-custom-args/fatal-warnings/i9266.scala rename to tests/neg/i9266.scala index 84268c078b49..2f00660dae7a 100644 --- a/tests/neg-custom-args/fatal-warnings/i9266.scala +++ b/tests/neg/i9266.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import language.`future-migration` def test = { implicit x: Int => x + x } // error diff --git a/tests/neg-custom-args/fatal-warnings/i9408a.check b/tests/neg/i9408a.check similarity index 59% rename from tests/neg-custom-args/fatal-warnings/i9408a.check rename to tests/neg/i9408a.check index ce2f8c4edd15..d9deb9cddaf7 100644 --- a/tests/neg-custom-args/fatal-warnings/i9408a.check +++ b/tests/neg/i9408a.check @@ -1,24 +1,24 @@ --- Error: tests/neg-custom-args/fatal-warnings/i9408a.scala:16:20 ------------------------------------------------------ -16 | val length: Int = "qwerty" // error +-- Error: tests/neg/i9408a.scala:18:20 --------------------------------------------------------------------------------- +18 | val length: Int = "qwerty" // error | ^^^^^^^^ |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-custom-args/fatal-warnings/i9408a.scala:21:20 ------------------------------------------------------ -21 | val length: Int = "qwerty" // error +-- Error: tests/neg/i9408a.scala:23:20 --------------------------------------------------------------------------------- +23 | val length: Int = "qwerty" // error | ^^^^^^^^ |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-custom-args/fatal-warnings/i9408a.scala:26:20 ------------------------------------------------------ -26 | val length: Int = "qwerty" // error +-- Error: tests/neg/i9408a.scala:28:20 --------------------------------------------------------------------------------- +28 | val length: Int = "qwerty" // error | ^^^^^^^^ |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-custom-args/fatal-warnings/i9408a.scala:31:20 ------------------------------------------------------ -31 | val length: Int = "qwerty" // error +-- Error: tests/neg/i9408a.scala:33:20 --------------------------------------------------------------------------------- +33 | val length: Int = "qwerty" // error | ^^^^^^^^ |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-custom-args/fatal-warnings/i9408a.scala:35:60 ------------------------------------------------------ -35 | implicit def a2int[A](a: A)(implicit ev: A => Int): Int = a // error +-- Error: tests/neg/i9408a.scala:37:60 --------------------------------------------------------------------------------- +37 | implicit def a2int[A](a: A)(implicit ev: A => Int): Int = a // error | ^ |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-custom-args/fatal-warnings/i9408a.scala:59:2 ------------------------------------------------------- -59 | 123.foo // error +-- Error: tests/neg/i9408a.scala:61:2 ---------------------------------------------------------------------------------- +61 | 123.foo // error | ^^^ |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. diff --git a/tests/neg-custom-args/fatal-warnings/i9408a.scala b/tests/neg/i9408a.scala similarity index 98% rename from tests/neg-custom-args/fatal-warnings/i9408a.scala rename to tests/neg/i9408a.scala index 754ca51b701a..0d5f4b45e000 100644 --- a/tests/neg-custom-args/fatal-warnings/i9408a.scala +++ b/tests/neg/i9408a.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import language.`3.0-migration` import scala.language.implicitConversions diff --git a/tests/neg-custom-args/fatal-warnings/i9408b.check b/tests/neg/i9408b.check similarity index 61% rename from tests/neg-custom-args/fatal-warnings/i9408b.check rename to tests/neg/i9408b.check index 55fed99ae3bb..5f8a854a9282 100644 --- a/tests/neg-custom-args/fatal-warnings/i9408b.check +++ b/tests/neg/i9408b.check @@ -1,5 +1,5 @@ --- Error: tests/neg-custom-args/fatal-warnings/i9408b/Test_2.scala:6:20 ------------------------------------------------ -6 | val length: Int = "abc" // error +-- Error: tests/neg/i9408b/Test_2.scala:8:20 --------------------------------------------------------------------------- +8 | val length: Int = "abc" // error | ^^^^^ |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. diff --git a/tests/neg-custom-args/fatal-warnings/i9408b/Conv_1.scala b/tests/neg/i9408b/Conv_1.scala similarity index 100% rename from tests/neg-custom-args/fatal-warnings/i9408b/Conv_1.scala rename to tests/neg/i9408b/Conv_1.scala diff --git a/tests/neg-custom-args/fatal-warnings/i9408b/Test_2.scala b/tests/neg/i9408b/Test_2.scala similarity index 84% rename from tests/neg-custom-args/fatal-warnings/i9408b/Test_2.scala rename to tests/neg/i9408b/Test_2.scala index 1c45f8ba66fe..8f86e28c30ca 100644 --- a/tests/neg-custom-args/fatal-warnings/i9408b/Test_2.scala +++ b/tests/neg/i9408b/Test_2.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import language.`3.0-migration` import scala.language.implicitConversions diff --git a/tests/neg-custom-args/i9517.scala b/tests/neg/i9517.scala similarity index 76% rename from tests/neg-custom-args/i9517.scala rename to tests/neg/i9517.scala index d1201d8ca39e..e764cd253e71 100644 --- a/tests/neg-custom-args/i9517.scala +++ b/tests/neg/i9517.scala @@ -1,3 +1,4 @@ +// scalac: -Xprint-types def test():Unit = foo({ case 1 => 10 }) // error def foo(x: Any): Boolean = true diff --git a/tests/neg/i9740.check b/tests/neg/i9740.check new file mode 100644 index 000000000000..359603a2863a --- /dev/null +++ b/tests/neg/i9740.check @@ -0,0 +1,12 @@ +-- [E186] Type Error: tests/neg/i9740.scala:10:9 ----------------------------------------------------------------------- +10 | case RecoveryCompleted => println("Recovery completed") // error + | ^^^^^^^^^^^^^^^^^ + | 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 + | ^^^^^^^^^^^^^^^^^ + | Implausible pattern: + | RecoveryCompleted could match selector of type TypedRecoveryCompleted + | only if there is an `equals` method identifying elements of the two types. diff --git a/tests/neg/i9740.scala b/tests/neg/i9740.scala index 2f342977ef5d..c96ae021b9b2 100644 --- a/tests/neg/i9740.scala +++ b/tests/neg/i9740.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings abstract class RecoveryCompleted object RecoveryCompleted extends RecoveryCompleted diff --git a/tests/neg/i9740b.scala b/tests/neg/i9740b.scala index 8006056684c7..4b441adc8356 100644 --- a/tests/neg/i9740b.scala +++ b/tests/neg/i9740b.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings enum Recovery: case RecoveryCompleted diff --git a/tests/neg/i9740c.scala b/tests/neg/i9740c.scala index 87881c9b20d7..9dd7eb48bf36 100644 --- a/tests/neg/i9740c.scala +++ b/tests/neg/i9740c.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings sealed trait Exp[T] case class IntExp(x: Int) extends Exp[Int] case class StrExp(x: String) extends Exp[String] diff --git a/tests/neg/i9740d.scala b/tests/neg/i9740d.scala index 9f2490b697b6..5e8f83faa1c9 100644 --- a/tests/neg/i9740d.scala +++ b/tests/neg/i9740d.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + sealed trait Exp[T] case class IntExp(x: Int) extends Exp[Int] case class StrExp(x: String) extends Exp[String] diff --git a/tests/neg-custom-args/fatal-warnings/i9751.scala b/tests/neg/i9751.scala similarity index 74% rename from tests/neg-custom-args/fatal-warnings/i9751.scala rename to tests/neg/i9751.scala index bb7d58957579..3d168bcc3642 100644 --- a/tests/neg-custom-args/fatal-warnings/i9751.scala +++ b/tests/neg/i9751.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + def f(): Unit = { () // error () diff --git a/tests/neg-custom-args/fatal-warnings/i9776.scala b/tests/neg/i9776.scala similarity index 97% rename from tests/neg-custom-args/fatal-warnings/i9776.scala rename to tests/neg/i9776.scala index 0de811e2adb3..50062b932c3b 100644 --- a/tests/neg-custom-args/fatal-warnings/i9776.scala +++ b/tests/neg/i9776.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.annotation.switch sealed trait Fruit diff --git a/tests/neg-custom-args/fatal-warnings/i9880.scala b/tests/neg/i9880.scala similarity index 96% rename from tests/neg-custom-args/fatal-warnings/i9880.scala rename to tests/neg/i9880.scala index d9d857110543..86255a4009ba 100644 --- a/tests/neg-custom-args/fatal-warnings/i9880.scala +++ b/tests/neg/i9880.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + opaque type Bytes = Array[Byte] object Bytes: extension (self: Bytes) diff --git a/tests/neg-custom-args/feature/impl-conv/A.scala b/tests/neg/impl-conv/A.scala similarity index 100% rename from tests/neg-custom-args/feature/impl-conv/A.scala rename to tests/neg/impl-conv/A.scala diff --git a/tests/neg-custom-args/feature/impl-conv/B.scala b/tests/neg/impl-conv/B.scala similarity index 76% rename from tests/neg-custom-args/feature/impl-conv/B.scala rename to tests/neg/impl-conv/B.scala index 45a51f28daf8..56befb18b2d7 100644 --- a/tests/neg-custom-args/feature/impl-conv/B.scala +++ b/tests/neg/impl-conv/B.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -feature + package implConv object B { diff --git a/tests/neg-custom-args/feature/implicit-conversions-old.scala b/tests/neg/implicit-conversions-old.scala similarity index 92% rename from tests/neg-custom-args/feature/implicit-conversions-old.scala rename to tests/neg/implicit-conversions-old.scala index 1050094dcaf1..c2673e8b96eb 100644 --- a/tests/neg-custom-args/feature/implicit-conversions-old.scala +++ b/tests/neg/implicit-conversions-old.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -feature + class A class B diff --git a/tests/neg-custom-args/feature/implicit-conversions.scala b/tests/neg/implicit-conversions.scala similarity index 92% rename from tests/neg-custom-args/feature/implicit-conversions.scala rename to tests/neg/implicit-conversions.scala index 2cf1a85d7540..0cec0de2f6ee 100644 --- a/tests/neg-custom-args/feature/implicit-conversions.scala +++ b/tests/neg/implicit-conversions.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -feature + class A class B diff --git a/tests/neg-custom-args/fatal-warnings/indentLeft.scala b/tests/neg/indentLeft.scala similarity index 81% rename from tests/neg-custom-args/fatal-warnings/indentLeft.scala rename to tests/neg/indentLeft.scala index 36734e354fed..177a4c0c33ae 100644 --- a/tests/neg-custom-args/fatal-warnings/indentLeft.scala +++ b/tests/neg/indentLeft.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object Test { if (true) { diff --git a/tests/neg-custom-args/indentRight.scala b/tests/neg/indentRight.scala similarity index 94% rename from tests/neg-custom-args/indentRight.scala rename to tests/neg/indentRight.scala index f00bec12fbff..644814689da9 100644 --- a/tests/neg-custom-args/indentRight.scala +++ b/tests/neg/indentRight.scala @@ -1,3 +1,5 @@ +// scalac: -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 diff --git a/tests/neg-custom-args/infix.scala b/tests/neg/infix.scala similarity index 96% rename from tests/neg-custom-args/infix.scala rename to tests/neg/infix.scala index f6f3053087dd..7e68b8fb823d 100644 --- a/tests/neg-custom-args/infix.scala +++ b/tests/neg/infix.scala @@ -1,3 +1,5 @@ +// scalac: -source future -deprecation -Xfatal-warnings + // Compile with -strict -Xfatal-warnings -deprecation class C: infix def op(x: Int): Int = ??? diff --git a/tests/neg-custom-args/fatal-warnings/inline-givens.scala b/tests/neg/inline-givens.scala similarity index 91% rename from tests/neg-custom-args/fatal-warnings/inline-givens.scala rename to tests/neg/inline-givens.scala index eae50bca45cf..d3edc13902dd 100644 --- a/tests/neg-custom-args/fatal-warnings/inline-givens.scala +++ b/tests/neg/inline-givens.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings class Item(x: String) diff --git a/tests/neg-custom-args/jdk-9-app.scala b/tests/neg/jdk-9-app.scala similarity index 86% rename from tests/neg-custom-args/jdk-9-app.scala rename to tests/neg/jdk-9-app.scala index 5709da34c466..21e09ec13643 100644 --- a/tests/neg-custom-args/jdk-9-app.scala +++ b/tests/neg/jdk-9-app.scala @@ -1,3 +1,5 @@ +// scalac: -release:8 + import java.lang.ProcessHandle // error: not a member object Jdk9App extends App { diff --git a/tests/neg-custom-args/kind-projector-underscores.scala b/tests/neg/kind-projector-underscores.scala similarity index 91% rename from tests/neg-custom-args/kind-projector-underscores.scala rename to tests/neg/kind-projector-underscores.scala index 64d46b16a7c6..1e80400105a8 100644 --- a/tests/neg-custom-args/kind-projector-underscores.scala +++ b/tests/neg/kind-projector-underscores.scala @@ -1,3 +1,5 @@ +// scalac: -Ykind-projector:underscores + package kind_projector_neg trait Foo[F[_]] diff --git a/tests/neg-custom-args/kind-projector.scala b/tests/neg/kind-projector.scala similarity index 85% rename from tests/neg-custom-args/kind-projector.scala rename to tests/neg/kind-projector.scala index 56f7894de078..dd0fb5d7149d 100644 --- a/tests/neg-custom-args/kind-projector.scala +++ b/tests/neg/kind-projector.scala @@ -1,3 +1,5 @@ +// scalac: -Ykind-projector + package kind_projector_neg trait Foo[F[_]] diff --git a/tests/neg-custom-args/explain/labelNotFound.check b/tests/neg/labelNotFound.check similarity index 80% rename from tests/neg-custom-args/explain/labelNotFound.check rename to tests/neg/labelNotFound.check index 594a838aeeed..94198a284014 100644 --- a/tests/neg-custom-args/explain/labelNotFound.check +++ b/tests/neg/labelNotFound.check @@ -1,5 +1,5 @@ --- [E172] Type Error: tests/neg-custom-args/explain/labelNotFound.scala:2:30 ------------------------------------------- -2 | scala.util.boundary.break(1) // error +-- [E172] Type Error: tests/neg/labelNotFound.scala:4:30 --------------------------------------------------------------- +4 | scala.util.boundary.break(1) // error | ^ |No given instance of type scala.util.boundary.Label[Int] was found for parameter label of method break in object boundary |--------------------------------------------------------------------------------------------------------------------- diff --git a/tests/neg-custom-args/explain/labelNotFound.scala b/tests/neg/labelNotFound.scala similarity index 71% rename from tests/neg-custom-args/explain/labelNotFound.scala rename to tests/neg/labelNotFound.scala index 2618600702da..313e37e961b4 100644 --- a/tests/neg-custom-args/explain/labelNotFound.scala +++ b/tests/neg/labelNotFound.scala @@ -1,2 +1,4 @@ +// scalac: -explain + object Test: scala.util.boundary.break(1) // error diff --git a/tests/neg-custom-args/erased/lambda-infer.scala b/tests/neg/lambda-infer.scala similarity index 92% rename from tests/neg-custom-args/erased/lambda-infer.scala rename to tests/neg/lambda-infer.scala index 2eebf8186b0d..e07c44523f60 100644 --- a/tests/neg-custom-args/erased/lambda-infer.scala +++ b/tests/neg/lambda-infer.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + type F = (Int, erased Int) => Int erased class A diff --git a/tests/neg-custom-args/fatal-warnings/main-functions-nameclash.scala b/tests/neg/main-functions-nameclash.scala similarity index 81% rename from tests/neg-custom-args/fatal-warnings/main-functions-nameclash.scala rename to tests/neg/main-functions-nameclash.scala index 407323591c87..148667da133f 100644 --- a/tests/neg-custom-args/fatal-warnings/main-functions-nameclash.scala +++ b/tests/neg/main-functions-nameclash.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings object foo { @main def foo(x: Int) = () // error: class foo and object foo produce classes that overwrite one another diff --git a/tests/neg-custom-args/deprecation/manifest-summoning.check b/tests/neg/manifest-summoning-b.check similarity index 73% rename from tests/neg-custom-args/deprecation/manifest-summoning.check rename to tests/neg/manifest-summoning-b.check index aa1462f8baba..bb63eebb555f 100644 --- a/tests/neg-custom-args/deprecation/manifest-summoning.check +++ b/tests/neg/manifest-summoning-b.check @@ -1,12 +1,12 @@ --- Error: tests/neg-custom-args/deprecation/manifest-summoning.scala:1:34 ---------------------------------------------- -1 |val foo = manifest[List[? <: Int]] // error +-- Error: tests/neg/manifest-summoning-b.scala:3:34 -------------------------------------------------------------------- +3 |val foo = manifest[List[? <: Int]] // error | ^ | 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-custom-args/deprecation/manifest-summoning.scala:2:41 ---------------------------------------------- -2 |val bar = optManifest[Array[? <: String]] // error +-- Error: tests/neg/manifest-summoning-b.scala:4:41 -------------------------------------------------------------------- +4 |val bar = optManifest[Array[? <: String]] // error | ^ | Compiler synthesis of Manifest and OptManifest is deprecated, instead | replace with the type `scala.reflect.ClassTag[Array[? <: String]]`. diff --git a/tests/neg-custom-args/deprecation/manifest-summoning.scala b/tests/neg/manifest-summoning-b.scala similarity index 69% rename from tests/neg-custom-args/deprecation/manifest-summoning.scala rename to tests/neg/manifest-summoning-b.scala index 7e9d9ee2cc9d..4dfee1f62f9a 100644 --- a/tests/neg-custom-args/deprecation/manifest-summoning.scala +++ b/tests/neg/manifest-summoning-b.scala @@ -1,2 +1,4 @@ +// scalac: -Xfatal-warnings -deprecation + val foo = manifest[List[? <: Int]] // error val bar = optManifest[Array[? <: String]] // error diff --git a/tests/neg-custom-args/matchable.scala b/tests/neg/matchable.scala similarity index 94% rename from tests/neg-custom-args/matchable.scala rename to tests/neg/matchable.scala index 388af29d25cf..5ffd09b714b2 100644 --- a/tests/neg-custom-args/matchable.scala +++ b/tests/neg/matchable.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -source future + def foo[T](x: T): Matchable = println(x.getClass()) // ok println(x.isInstanceOf[Int]) // ok diff --git a/tests/neg-custom-args/missing-targetName.scala b/tests/neg/missing-targetName.scala similarity index 84% rename from tests/neg-custom-args/missing-targetName.scala rename to tests/neg/missing-targetName.scala index c32ef461aee0..9e83d2ad72ae 100644 --- a/tests/neg-custom-args/missing-targetName.scala +++ b/tests/neg/missing-targetName.scala @@ -1,3 +1,5 @@ +// scalac: -Yrequire-targetName -Xfatal-warnings + // Compile with -strict -Xfatal-warnings -deprecation import scala.annotation.targetName class & { // error diff --git a/tests/neg-custom-args/erased/multiple-args-consume.scala b/tests/neg/multiple-args-consume.scala similarity index 87% rename from tests/neg-custom-args/erased/multiple-args-consume.scala rename to tests/neg/multiple-args-consume.scala index e4aaacca8969..c8ea23f92318 100644 --- a/tests/neg-custom-args/erased/multiple-args-consume.scala +++ b/tests/neg/multiple-args-consume.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + def foo(erased x: Int, y: Int) = y def bar(x: Int, erased y: Int) = x diff --git a/tests/neg-custom-args/erased/multiple-args.scala b/tests/neg/multiple-args.scala similarity index 84% rename from tests/neg-custom-args/erased/multiple-args.scala rename to tests/neg/multiple-args.scala index fb9bce8e4573..41e65ab8390b 100644 --- a/tests/neg-custom-args/erased/multiple-args.scala +++ b/tests/neg/multiple-args.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + def foo(x: Int, erased y: Int): Int = x def bar(erased x: Int, y: Int): Int = y diff --git a/tests/neg-custom-args/newline-braces.scala b/tests/neg/newline-braces.scala similarity index 73% rename from tests/neg-custom-args/newline-braces.scala rename to tests/neg/newline-braces.scala index 0a5e2a469bf3..96e634a32773 100644 --- a/tests/neg-custom-args/newline-braces.scala +++ b/tests/neg/newline-braces.scala @@ -1,3 +1,5 @@ +// scalac: -source 3.0-migration -Xfatal-warnings + def f: List[Int] = { List(1, 2, 3).map // no newline inserted here in Scala-2 compat mode { x => // error (migration) diff --git a/tests/neg-no-kind-polymorphism/anykind.scala b/tests/neg/no-kind-polymorphism-anykind.scala similarity index 63% rename from tests/neg-no-kind-polymorphism/anykind.scala rename to tests/neg/no-kind-polymorphism-anykind.scala index 07c98c4f9576..daefc1774093 100644 --- a/tests/neg-no-kind-polymorphism/anykind.scala +++ b/tests/neg/no-kind-polymorphism-anykind.scala @@ -1,2 +1,3 @@ +// scalac: -Yno-kind-polymorphism trait Foo[T <: AnyKind] // error: Not found: type AnyKind diff --git a/tests/neg-custom-args/fatal-warnings/nonunit-statement.scala b/tests/neg/nonunit-statement.scala similarity index 98% rename from tests/neg-custom-args/fatal-warnings/nonunit-statement.scala rename to tests/neg/nonunit-statement.scala index 399d132edfae..d48fb99841fb 100644 --- a/tests/neg-custom-args/fatal-warnings/nonunit-statement.scala +++ b/tests/neg/nonunit-statement.scala @@ -1,4 +1,4 @@ -// scalac: -Wnonunit-statement -Wvalue-discard +// scalac: -Xfatal-warnings -Wnonunit-statement -Wvalue-discard import collection.ArrayOps import collection.mutable.{ArrayBuilder, LinkedHashSet, ListBuffer} import concurrent._ diff --git a/tests/neg-custom-args/nowarn/nowarn-parser-error.check b/tests/neg/nowarn-parser-error.check similarity index 54% rename from tests/neg-custom-args/nowarn/nowarn-parser-error.check rename to tests/neg/nowarn-parser-error.check index 8be545a288a6..27c44dc1df3b 100644 --- a/tests/neg-custom-args/nowarn/nowarn-parser-error.check +++ b/tests/neg/nowarn-parser-error.check @@ -1,11 +1,11 @@ --- [E040] Syntax Error: tests/neg-custom-args/nowarn/nowarn-parser-error.scala:3:6 ------------------------------------- -3 | def def // error +-- [E040] Syntax Error: tests/neg/nowarn-parser-error.scala:5:6 -------------------------------------------------------- +5 | def def // error | ^^^ | an identifier expected, but 'def' found | | longer explanation available when compiling with `-explain` --- [E002] Syntax Warning: tests/neg-custom-args/nowarn/nowarn-parser-error.scala:2:10 ---------------------------------- -2 | def a = try 1 // warn +-- [E002] Syntax Warning: tests/neg/nowarn-parser-error.scala:4:10 ----------------------------------------------------- +4 | def a = try 1 // warn | ^^^^^ | A try without catch or finally is equivalent to putting | its body in a block; no exceptions are handled. diff --git a/tests/neg-custom-args/nowarn/nowarn-parser-error.scala b/tests/neg/nowarn-parser-error.scala similarity index 57% rename from tests/neg-custom-args/nowarn/nowarn-parser-error.scala rename to tests/neg/nowarn-parser-error.scala index 2c65d3cf1838..7ff6c18ee306 100644 --- a/tests/neg-custom-args/nowarn/nowarn-parser-error.scala +++ b/tests/neg/nowarn-parser-error.scala @@ -1,3 +1,5 @@ +// scalac: -deprecation -Wunused:nowarn + class C { def a = try 1 // warn def def // error diff --git a/tests/neg/nowarn-typer-error.check b/tests/neg/nowarn-typer-error.check new file mode 100644 index 000000000000..5da16881cb39 --- /dev/null +++ b/tests/neg/nowarn-typer-error.check @@ -0,0 +1,6 @@ +-- [E006] Not Found Error: tests/neg/nowarn-typer-error.scala:6:11 ----------------------------------------------------- +6 | def t1 = / // error + | ^ + | Not found: / + | + | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/nowarn/nowarn-typer-error.scala b/tests/neg/nowarn-typer-error.scala similarity index 84% rename from tests/neg-custom-args/nowarn/nowarn-typer-error.scala rename to tests/neg/nowarn-typer-error.scala index 8ab871b108f6..6c56110bc377 100644 --- a/tests/neg-custom-args/nowarn/nowarn-typer-error.scala +++ b/tests/neg/nowarn-typer-error.scala @@ -1,3 +1,5 @@ +// scalac: -deprecation -Wunused:nowarn + import annotation.nowarn object T { @deprecated def f = 1 diff --git a/tests/neg-custom-args/nowarn/nowarn.check b/tests/neg/nowarn.check similarity index 50% rename from tests/neg-custom-args/nowarn/nowarn.check rename to tests/neg/nowarn.check index 855f741a15bf..3e16314f643e 100644 --- a/tests/neg-custom-args/nowarn/nowarn.check +++ b/tests/neg/nowarn.check @@ -1,26 +1,26 @@ --- [E002] Syntax Warning: tests/neg-custom-args/nowarn/nowarn.scala:9:10 ----------------------------------------------- -9 |def t1a = try 1 // warning (parser) - | ^^^^^ - | A try without catch or finally is equivalent to putting - | its body in a block; no exceptions are handled. - | - | longer explanation available when compiling with `-explain` --- [E002] Syntax Warning: tests/neg-custom-args/nowarn/nowarn.scala:23:25 ---------------------------------------------- -23 |@nowarn(o.inl) def t2d = try 1 // two warnings (`inl` is not a compile-time constant) +-- [E002] Syntax Warning: tests/neg/nowarn.scala:11:10 ----------------------------------------------------------------- +11 |def t1a = try 1 // warning (parser) + | ^^^^^ + | A try without catch or finally is equivalent to putting + | its body in a block; no exceptions are handled. + | + | longer explanation available when compiling with `-explain` +-- [E002] Syntax Warning: tests/neg/nowarn.scala:25:25 ----------------------------------------------------------------- +25 |@nowarn(o.inl) def t2d = try 1 // two warnings (`inl` is not a compile-time constant) | ^^^^^ | A try without catch or finally is equivalent to putting | its body in a block; no exceptions are handled. | | longer explanation available when compiling with `-explain` --- [E002] Syntax Warning: tests/neg-custom-args/nowarn/nowarn.scala:31:26 ---------------------------------------------- -31 |@nowarn("id=1") def t4d = try 1 // error and warning (unused nowarn, wrong id) +-- [E002] Syntax Warning: tests/neg/nowarn.scala:33:26 ----------------------------------------------------------------- +33 |@nowarn("id=1") def t4d = try 1 // error and warning (unused nowarn, wrong id) | ^^^^^ | A try without catch or finally is equivalent to putting | its body in a block; no exceptions are handled. | | longer explanation available when compiling with `-explain` --- [E002] Syntax Warning: tests/neg-custom-args/nowarn/nowarn.scala:33:28 ---------------------------------------------- -33 |@nowarn("verbose") def t5 = try 1 // warning with details +-- [E002] Syntax Warning: tests/neg/nowarn.scala:35:28 ----------------------------------------------------------------- +35 |@nowarn("verbose") def t5 = try 1 // warning with details | ^^^^^ | A try without catch or finally is equivalent to putting | its body in a block; no exceptions are handled. @@ -29,80 +29,80 @@ Matching filters for @nowarn or -Wconf: - name=EmptyCatchAndFinallyBlock | | longer explanation available when compiling with `-explain` --- [E129] Potential Issue Warning: tests/neg-custom-args/nowarn/nowarn.scala:13:11 ------------------------------------- -13 |def t2 = { 1; 2 } // warning (the invalid nowarn doesn't silence anything) +-- [E129] Potential Issue Warning: tests/neg/nowarn.scala:15:11 -------------------------------------------------------- +15 |def t2 = { 1; 2 } // warning (the invalid nowarn doesn't silence anything) | ^ | A pure expression does nothing in statement position; you may be omitting necessary parentheses | | longer explanation available when compiling with `-explain` --- Warning: tests/neg-custom-args/nowarn/nowarn.scala:12:8 ------------------------------------------------------------- -12 |@nowarn("wat?") // warning (typer, invalid filter) +-- Warning: tests/neg/nowarn.scala:14:8 -------------------------------------------------------------------------------- +14 |@nowarn("wat?") // warning (typer, invalid filter) | ^^^^^^ | Invalid message filter | unknown filter: wat? --- [E129] Potential Issue Warning: tests/neg-custom-args/nowarn/nowarn.scala:16:12 ------------------------------------- -16 |def t2a = { 1; 2 } // warning (invalid nowarn doesn't silence) +-- [E129] Potential Issue Warning: tests/neg/nowarn.scala:18:12 -------------------------------------------------------- +18 |def t2a = { 1; 2 } // warning (invalid nowarn doesn't silence) | ^ | A pure expression does nothing in statement position; you may be omitting necessary parentheses | | longer explanation available when compiling with `-explain` --- Warning: tests/neg-custom-args/nowarn/nowarn.scala:15:8 ------------------------------------------------------------- -15 |@nowarn(t1a.toString) // warning (typer, argument not a compile-time constant) +-- Warning: tests/neg/nowarn.scala:17:8 -------------------------------------------------------------------------------- +17 |@nowarn(t1a.toString) // warning (typer, argument not a compile-time constant) | ^^^^^^^^^^^^ | filter needs to be a compile-time constant string --- Warning: tests/neg-custom-args/nowarn/nowarn.scala:23:10 ------------------------------------------------------------ -23 |@nowarn(o.inl) def t2d = try 1 // two warnings (`inl` is not a compile-time constant) +-- Warning: tests/neg/nowarn.scala:25:10 ------------------------------------------------------------------------------- +25 |@nowarn(o.inl) def t2d = try 1 // two warnings (`inl` is not a compile-time constant) | ^^^^^ | filter needs to be a compile-time constant string --- Deprecation Warning: tests/neg-custom-args/nowarn/nowarn.scala:37:10 ------------------------------------------------ -37 |def t6a = f // warning (refchecks, deprecation) +-- Deprecation Warning: tests/neg/nowarn.scala:39:10 ------------------------------------------------------------------- +39 |def t6a = f // warning (refchecks, deprecation) | ^ | method f is deprecated --- Deprecation Warning: tests/neg-custom-args/nowarn/nowarn.scala:40:30 ------------------------------------------------ -40 |@nowarn("msg=fish") def t6d = f // error (unused nowarn), warning (deprecation) +-- Deprecation Warning: tests/neg/nowarn.scala:42:30 ------------------------------------------------------------------- +42 |@nowarn("msg=fish") def t6d = f // error (unused nowarn), warning (deprecation) | ^ | method f is deprecated --- Deprecation Warning: tests/neg-custom-args/nowarn/nowarn.scala:47:10 ------------------------------------------------ -47 |def t7c = f // warning (deprecation) +-- Deprecation Warning: tests/neg/nowarn.scala:49:10 ------------------------------------------------------------------- +49 |def t7c = f // warning (deprecation) | ^ | method f is deprecated --- Unchecked Warning: tests/neg-custom-args/nowarn/nowarn.scala:53:7 --------------------------------------------------- -53 | case _: List[Int] => 0 // warning (patmat, unchecked) +-- Unchecked Warning: tests/neg/nowarn.scala:55:7 ---------------------------------------------------------------------- +55 | case _: List[Int] => 0 // warning (patmat, unchecked) | ^ |the type test for List[Int] cannot be checked at runtime because its type arguments can't be determined from Any --- Error: tests/neg-custom-args/nowarn/nowarn.scala:31:1 --------------------------------------------------------------- -31 |@nowarn("id=1") def t4d = try 1 // error and warning (unused nowarn, wrong id) +-- Error: tests/neg/nowarn.scala:33:1 ---------------------------------------------------------------------------------- +33 |@nowarn("id=1") def t4d = try 1 // error and warning (unused nowarn, wrong id) |^^^^^^^^^^^^^^^ |@nowarn annotation does not suppress any warnings --- Error: tests/neg-custom-args/nowarn/nowarn.scala:40:1 --------------------------------------------------------------- -40 |@nowarn("msg=fish") def t6d = f // error (unused nowarn), warning (deprecation) +-- Error: tests/neg/nowarn.scala:42:1 ---------------------------------------------------------------------------------- +42 |@nowarn("msg=fish") def t6d = f // error (unused nowarn), warning (deprecation) |^^^^^^^^^^^^^^^^^^^ |@nowarn annotation does not suppress any warnings --- Error: tests/neg-custom-args/nowarn/nowarn.scala:48:5 --------------------------------------------------------------- -48 | : @nowarn("msg=fish") // error (unused nowarn) +-- Error: tests/neg/nowarn.scala:50:5 ---------------------------------------------------------------------------------- +50 | : @nowarn("msg=fish") // error (unused nowarn) | ^^^^^^^^^^^^^^^^^^^ | @nowarn annotation does not suppress any warnings --- Error: tests/neg-custom-args/nowarn/nowarn.scala:60:0 --------------------------------------------------------------- -60 |@nowarn def t9a = { 1: @nowarn; 2 } // error (outer @nowarn is unused) +-- Error: tests/neg/nowarn.scala:62:0 ---------------------------------------------------------------------------------- +62 |@nowarn def t9a = { 1: @nowarn; 2 } // error (outer @nowarn is unused) |^^^^^^^ |@nowarn annotation does not suppress any warnings --- Error: tests/neg-custom-args/nowarn/nowarn.scala:61:27 -------------------------------------------------------------- -61 |@nowarn def t9b = { 1: Int @nowarn; 2 } // error (inner @nowarn is unused, it covers the type, not the expression) +-- Error: tests/neg/nowarn.scala:63:27 --------------------------------------------------------------------------------- +63 |@nowarn def t9b = { 1: Int @nowarn; 2 } // error (inner @nowarn is unused, it covers the type, not the expression) | ^^^^^^^ | @nowarn annotation does not suppress any warnings --- Error: tests/neg-custom-args/nowarn/nowarn.scala:66:0 --------------------------------------------------------------- -66 |@nowarn @ann(f) def t10b = 0 // error (unused nowarn) +-- Error: tests/neg/nowarn.scala:68:0 ---------------------------------------------------------------------------------- +68 |@nowarn @ann(f) def t10b = 0 // error (unused nowarn) |^^^^^^^ |@nowarn annotation does not suppress any warnings --- Error: tests/neg-custom-args/nowarn/nowarn.scala:67:8 --------------------------------------------------------------- -67 |@ann(f: @nowarn) def t10c = 0 // error (unused nowarn), should be silent +-- Error: tests/neg/nowarn.scala:69:8 ---------------------------------------------------------------------------------- +69 |@ann(f: @nowarn) def t10c = 0 // error (unused nowarn), should be silent | ^^^^^^^ | @nowarn annotation does not suppress any warnings --- Error: tests/neg-custom-args/nowarn/nowarn.scala:70:0 --------------------------------------------------------------- -70 |@nowarn class I1a { // error (unused nowarn) +-- Error: tests/neg/nowarn.scala:72:0 ---------------------------------------------------------------------------------- +72 |@nowarn class I1a { // error (unused nowarn) |^^^^^^^ |@nowarn annotation does not suppress any warnings --- Error: tests/neg-custom-args/nowarn/nowarn.scala:75:0 --------------------------------------------------------------- -75 |@nowarn class I1b { // error (unused nowarn) +-- Error: tests/neg/nowarn.scala:77:0 ---------------------------------------------------------------------------------- +77 |@nowarn class I1b { // error (unused nowarn) |^^^^^^^ |@nowarn annotation does not suppress any warnings diff --git a/tests/neg-custom-args/nowarn/nowarn.scala b/tests/neg/nowarn.scala similarity index 96% rename from tests/neg-custom-args/nowarn/nowarn.scala rename to tests/neg/nowarn.scala index f5d10a5f262a..b40edfa6571c 100644 --- a/tests/neg-custom-args/nowarn/nowarn.scala +++ b/tests/neg/nowarn.scala @@ -1,3 +1,5 @@ +// scalac: -deprecation -Wunused:nowarn "-Wconf:msg=@nowarn annotation does not suppress any warnings:e" + import scala.annotation.{ nowarn, Annotation } // This test doesn't run with `-Werror`, because once there's an error, later phases are skipped and we would not see diff --git a/tests/neg-custom-args/deprecation/old-syntax.scala b/tests/neg/old-syntax.scala similarity index 69% rename from tests/neg-custom-args/deprecation/old-syntax.scala rename to tests/neg/old-syntax.scala index 0ba7bbee7db0..e974e1a258e2 100644 --- a/tests/neg-custom-args/deprecation/old-syntax.scala +++ b/tests/neg/old-syntax.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings -deprecation val f = (x: Int) ⇒ x + 1 // error diff --git a/tests/neg-custom-args/fatal-warnings/opaque-match.scala b/tests/neg/opaque-match.scala similarity index 84% rename from tests/neg-custom-args/fatal-warnings/opaque-match.scala rename to tests/neg/opaque-match.scala index f48a11168274..54f28a90f26e 100644 --- a/tests/neg-custom-args/fatal-warnings/opaque-match.scala +++ b/tests/neg/opaque-match.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + case class C() object O: @@ -17,7 +19,7 @@ def Test[T] = (??? : Any) match case _: List[O.T] => ??? // error (??? : Any) match - case _: List[O.T @unchecked] => ??? // OK + case _: List[O.T @unchecked] => ??? // OK (??? : Any) match case _: List[T] => ??? // error diff --git a/tests/neg-custom-args/overrideClass.scala b/tests/neg/overrideClass.scala similarity index 93% rename from tests/neg-custom-args/overrideClass.scala rename to tests/neg/overrideClass.scala index 431b846d90ce..eb5dcbe7ab39 100644 --- a/tests/neg-custom-args/overrideClass.scala +++ b/tests/neg/overrideClass.scala @@ -1,3 +1,5 @@ +// scalac: -source 3.0-migration + abstract class FooA { type A <: Ax; abstract class Ax; diff --git a/tests/neg-custom-args/ovlazy.scala b/tests/neg/ovlazy.scala similarity index 64% rename from tests/neg-custom-args/ovlazy.scala rename to tests/neg/ovlazy.scala index 3a263e5ed4bf..86d27ca37b03 100644 --- a/tests/neg-custom-args/ovlazy.scala +++ b/tests/neg/ovlazy.scala @@ -1,3 +1,5 @@ +// scalac: -source 3.0-migration -Xfatal-warnings + class A { val x: Int = 1 } diff --git a/tests/neg-custom-args/fatal-warnings/pureStatement.scala b/tests/neg/pureStatement.scala similarity index 96% rename from tests/neg-custom-args/fatal-warnings/pureStatement.scala rename to tests/neg/pureStatement.scala index 80ee7c589dc7..c4c1c0799fa3 100644 --- a/tests/neg-custom-args/fatal-warnings/pureStatement.scala +++ b/tests/neg/pureStatement.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + class IOCapability object Test { diff --git a/tests/neg-custom-args/fatal-warnings/quote-simple-hole.scala b/tests/neg/quote-simple-hole.scala similarity index 92% rename from tests/neg-custom-args/fatal-warnings/quote-simple-hole.scala rename to tests/neg/quote-simple-hole.scala index 35308cc36161..2724a3c6d95c 100644 --- a/tests/neg-custom-args/fatal-warnings/quote-simple-hole.scala +++ b/tests/neg/quote-simple-hole.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.quoted.Quotes def test(using Quotes) = { diff --git a/tests/neg/refinements-this.scala b/tests/neg/refinements-this.scala new file mode 100644 index 000000000000..87814419b942 --- /dev/null +++ b/tests/neg/refinements-this.scala @@ -0,0 +1,5 @@ +// scalac: -Xfatal-warnings + +class Outer: + type X = { type O = Outer.this.type } // ok + type Y = { type O = this.type } // error diff --git a/tests/neg/sip-53-exprimental-a.scala b/tests/neg/sip-53-exprimental-a.scala new file mode 100644 index 000000000000..f9ce25aba095 --- /dev/null +++ b/tests/neg/sip-53-exprimental-a.scala @@ -0,0 +1,11 @@ +// scalac: -Yno-experimental + +import scala.quoted.* + +def foo(using Quotes): Unit = + (??? : Type[?]) match + case '[ (t, t, t) ] => // error // error + '{ ??? : Any } match + case '{ type u; $x: u } => // error + case '{ type u; ($ls: List[u]).map($f: u => Int) } => // error // error + diff --git a/tests/neg/sip-53-exprimental-b.scala b/tests/neg/sip-53-exprimental-b.scala new file mode 100644 index 000000000000..05ef481b073b --- /dev/null +++ b/tests/neg/sip-53-exprimental-b.scala @@ -0,0 +1,10 @@ +// scalac: -Yno-experimental + +import scala.quoted.* + +def empty[K <: AnyKind : Type](using Quotes): Type[?] = + Type.of[K] match + case '[type t; `t`] => Type.of[t] // error + case '[type f[X]; `f`] => Type.of[f] // error + case '[type f[X <: Int, Y]; `f`] => Type.of[f] // error + case '[type k <: AnyKind; `k` ] => Type.of[k] // error diff --git a/tests/neg-custom-args/fatal-warnings/strict-pattern-bindings-3.2.scala b/tests/neg/strict-pattern-bindings-3.2.scala similarity index 97% rename from tests/neg-custom-args/fatal-warnings/strict-pattern-bindings-3.2.scala rename to tests/neg/strict-pattern-bindings-3.2.scala index 23c8af3f0f19..d6c7a3ad70bb 100644 --- a/tests/neg-custom-args/fatal-warnings/strict-pattern-bindings-3.2.scala +++ b/tests/neg/strict-pattern-bindings-3.2.scala @@ -1,3 +1,4 @@ +// scalac: -Xfatal-warnings // These tests should fail under -Xfatal-warnings with source version source version 3.2 or later import language.`3.2` diff --git a/tests/neg-custom-args/fatal-warnings/structural.scala b/tests/neg/structural-2.scala similarity index 98% rename from tests/neg-custom-args/fatal-warnings/structural.scala rename to tests/neg/structural-2.scala index e24eeeae105b..e7d0c67ff6b4 100644 --- a/tests/neg-custom-args/fatal-warnings/structural.scala +++ b/tests/neg/structural-2.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.reflect.Selectable.reflectiveSelectable package p1 { diff --git a/tests/neg-custom-args/fatal-warnings/supertraits.scala b/tests/neg/supertraits-b.scala similarity index 96% rename from tests/neg-custom-args/fatal-warnings/supertraits.scala rename to tests/neg/supertraits-b.scala index 9337e2f925a3..7e8560ee45c0 100644 --- a/tests/neg-custom-args/fatal-warnings/supertraits.scala +++ b/tests/neg/supertraits-b.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + transparent sealed trait TA transparent sealed trait TB trait S diff --git a/tests/neg-custom-args/fatal-warnings/suppressed-type-test-warnings.scala b/tests/neg/suppressed-type-test-warnings.scala similarity index 96% rename from tests/neg-custom-args/fatal-warnings/suppressed-type-test-warnings.scala rename to tests/neg/suppressed-type-test-warnings.scala index 92d86b3307e5..332bcc3e0889 100644 --- a/tests/neg-custom-args/fatal-warnings/suppressed-type-test-warnings.scala +++ b/tests/neg/suppressed-type-test-warnings.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object Test { sealed trait Foo[A, B] final case class Bar[X](x: X) extends Foo[X, X] diff --git a/tests/neg-custom-args/fatal-warnings/switches.scala b/tests/neg/switches.scala similarity index 99% rename from tests/neg-custom-args/fatal-warnings/switches.scala rename to tests/neg/switches.scala index a327ab88758a..3641b49d3e0c 100644 --- a/tests/neg-custom-args/fatal-warnings/switches.scala +++ b/tests/neg/switches.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.annotation.switch // this is testing not so much how things ought to be but how they are; diff --git a/tests/neg/symbolic-packages.check b/tests/neg/symbolic-packages.check new file mode 100644 index 000000000000..8e9b7e114829 --- /dev/null +++ b/tests/neg/symbolic-packages.check @@ -0,0 +1,16 @@ +-- Error: tests/neg/symbolic-packages.scala:3:8 ------------------------------------------------------------------------ +3 |package `with spaces` { // error + | ^^^^^^^^^^^^^ + | 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 + | ^ + | 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 + | ^ + | 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 + | ^^^^^^^ + | The package name `mixed_*` will be encoded on the classpath, and can lead to undefined behaviour. diff --git a/tests/neg-custom-args/fatal-warnings/symbolic-packages.scala b/tests/neg/symbolic-packages.scala similarity index 83% rename from tests/neg-custom-args/fatal-warnings/symbolic-packages.scala rename to tests/neg/symbolic-packages.scala index 4e8ec2b15a0e..b9d365d44986 100644 --- a/tests/neg-custom-args/fatal-warnings/symbolic-packages.scala +++ b/tests/neg/symbolic-packages.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + package `with spaces` { // error class Foo } diff --git a/tests/neg-custom-args/deprecation/t3235-minimal.check b/tests/neg/t3235-minimal.check similarity index 54% rename from tests/neg-custom-args/deprecation/t3235-minimal.check rename to tests/neg/t3235-minimal.check index 665caab69d8d..83c287f85bc0 100644 --- a/tests/neg-custom-args/deprecation/t3235-minimal.check +++ b/tests/neg/t3235-minimal.check @@ -1,16 +1,16 @@ --- Error: tests/neg-custom-args/deprecation/t3235-minimal.scala:3:21 --------------------------------------------------- -3 | assert(123456789.round == 123456789) // error +-- Error: tests/neg/t3235-minimal.scala:5:21 --------------------------------------------------------------------------- +5 | assert(123456789.round == 123456789) // error | ^^^^^^^^^^^^^^^ |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-custom-args/deprecation/t3235-minimal.scala:4:16 --------------------------------------------------- -4 | assert(math.round(123456789) == 123456789) // error +-- Error: tests/neg/t3235-minimal.scala:6:16 --------------------------------------------------------------------------- +6 | assert(math.round(123456789) == 123456789) // error | ^^^^^^^^^^ |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-custom-args/deprecation/t3235-minimal.scala:5:32 --------------------------------------------------- -5 | assert(1234567890123456789L.round == 1234567890123456789L) // error +-- Error: tests/neg/t3235-minimal.scala:7:32 --------------------------------------------------------------------------- +7 | assert(1234567890123456789L.round == 1234567890123456789L) // error | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |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-custom-args/deprecation/t3235-minimal.scala:6:16 --------------------------------------------------- -6 | assert(math.round(1234567890123456789L) == 1234567890123456789L) // error +-- Error: tests/neg/t3235-minimal.scala:8:16 --------------------------------------------------------------------------- +8 | assert(math.round(1234567890123456789L) == 1234567890123456789L) // error | ^^^^^^^^^^ |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? diff --git a/tests/neg-custom-args/deprecation/t3235-minimal.scala b/tests/neg/t3235-minimal.scala similarity index 88% rename from tests/neg-custom-args/deprecation/t3235-minimal.scala rename to tests/neg/t3235-minimal.scala index 3aef0eea2dae..22b29ef1fb31 100644 --- a/tests/neg-custom-args/deprecation/t3235-minimal.scala +++ b/tests/neg/t3235-minimal.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings -deprecation + object Test { def main(args: Array[String]): Unit = { assert(123456789.round == 123456789) // error diff --git a/tests/neg-custom-args/fatal-warnings/t5830.scala b/tests/neg/t5830.scala similarity index 87% rename from tests/neg-custom-args/fatal-warnings/t5830.scala rename to tests/neg/t5830.scala index 629b345d3737..2e02d802b8e0 100644 --- a/tests/neg-custom-args/fatal-warnings/t5830.scala +++ b/tests/neg/t5830.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.annotation.switch class Test { diff --git a/tests/neg-custom-args/erased/tupled-function-instances.scala b/tests/neg/tupled-function-instances-2.scala similarity index 99% rename from tests/neg-custom-args/erased/tupled-function-instances.scala rename to tests/neg/tupled-function-instances-2.scala index 3574125285e4..b1ae120b8789 100644 --- a/tests/neg-custom-args/erased/tupled-function-instances.scala +++ b/tests/neg/tupled-function-instances-2.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + import scala.util.TupledFunction object Test { def main(args: Array[String]): Unit = { diff --git a/tests/neg-custom-args/fatal-warnings/type-test-paths-2.scala b/tests/neg/type-test-paths-2.scala similarity index 97% rename from tests/neg-custom-args/fatal-warnings/type-test-paths-2.scala rename to tests/neg/type-test-paths-2.scala index 488f704a20bc..e27db5a6636f 100644 --- a/tests/neg-custom-args/fatal-warnings/type-test-paths-2.scala +++ b/tests/neg/type-test-paths-2.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.reflect.TypeTest trait R { diff --git a/tests/neg-custom-args/fatal-warnings/type-test-paths.scala b/tests/neg/type-test-paths.scala similarity index 95% rename from tests/neg-custom-args/fatal-warnings/type-test-paths.scala rename to tests/neg/type-test-paths.scala index a8cd6334e769..45106bcb03e5 100644 --- a/tests/neg-custom-args/fatal-warnings/type-test-paths.scala +++ b/tests/neg/type-test-paths.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.reflect.TypeTest object Test { diff --git a/tests/neg-custom-args/fatal-warnings/type-test-syntesize.scala b/tests/neg/type-test-syntesize-b.scala similarity index 93% rename from tests/neg-custom-args/fatal-warnings/type-test-syntesize.scala rename to tests/neg/type-test-syntesize-b.scala index 45ef924ce55a..2fa8d2b9a3f3 100644 --- a/tests/neg-custom-args/fatal-warnings/type-test-syntesize.scala +++ b/tests/neg/type-test-syntesize-b.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.reflect.TypeTest object Test { diff --git a/tests/neg-custom-args/typeclass-derivation2.scala b/tests/neg/typeclass-derivation2.scala similarity index 99% rename from tests/neg-custom-args/typeclass-derivation2.scala rename to tests/neg/typeclass-derivation2.scala index be54d7697994..d4c4b256a4e5 100644 --- a/tests/neg-custom-args/typeclass-derivation2.scala +++ b/tests/neg/typeclass-derivation2.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + import scala.collection.mutable import scala.annotation.tailrec diff --git a/tests/neg-custom-args/fatal-warnings/unchecked-patterns.scala b/tests/neg/unchecked-patterns.scala similarity index 96% rename from tests/neg-custom-args/fatal-warnings/unchecked-patterns.scala rename to tests/neg/unchecked-patterns.scala index 649972d29c64..8974a2ad9dca 100644 --- a/tests/neg-custom-args/fatal-warnings/unchecked-patterns.scala +++ b/tests/neg/unchecked-patterns.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object Test { val (y1: Some[Int]) = Some(1): Option[Int] @unchecked // OK diff --git a/tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala b/tests/neg/xfatalWarnings.scala similarity index 90% rename from tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala rename to tests/neg/xfatalWarnings.scala index 862b94039e2a..aa1be34b2f84 100644 --- a/tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala +++ b/tests/neg/xfatalWarnings.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + object xfatalWarnings { val opt:Option[String] = Some("test") diff --git a/tests/pos-custom-args/i9267.scala b/tests/pos-custom-args/i9267.scala deleted file mode 100644 index 83d15dc739b5..000000000000 --- a/tests/pos-custom-args/i9267.scala +++ /dev/null @@ -1 +0,0 @@ -class A diff --git a/tests/pos-custom-args/no-experimental/dotty-experimental.scala b/tests/pos-custom-args/no-experimental/dotty-experimental.scala deleted file mode 100644 index 72d16ddd9b15..000000000000 --- a/tests/pos-custom-args/no-experimental/dotty-experimental.scala +++ /dev/null @@ -1,6 +0,0 @@ -package dotty.tools -object test { - - val x = caps.cap - -} diff --git a/tests/pos-custom-args/strict/adhoc-extension/A.scala b/tests/pos-custom-args/strict/adhoc-extension/A.scala deleted file mode 100644 index ff2e6bf29883..000000000000 --- a/tests/pos-custom-args/strict/adhoc-extension/A.scala +++ /dev/null @@ -1,3 +0,0 @@ -package adhoc -class A -abstract class Abs \ No newline at end of file diff --git a/tests/pos-custom-args/strict/i10383.scala b/tests/pos-custom-args/strict/i10383.scala deleted file mode 100644 index ca54464eb514..000000000000 --- a/tests/pos-custom-args/strict/i10383.scala +++ /dev/null @@ -1 +0,0 @@ -def r = BigInt(1) to BigInt(3) // error diff --git a/tests/pos-custom-args/strict/i16808.scala b/tests/pos-custom-args/strict/i16808.scala deleted file mode 100644 index 602ceed94161..000000000000 --- a/tests/pos-custom-args/strict/i16808.scala +++ /dev/null @@ -1,2 +0,0 @@ -def collectKeys[A, B, C](xs: Map[A, B])(f: PartialFunction[A, C]): Map[C, B] = - xs.collect{ case (f(c) , b) => (c, b) } \ No newline at end of file diff --git a/tests/pos-custom-args/strict/i7296.scala b/tests/pos-custom-args/strict/i7296.scala deleted file mode 100644 index 3b582ad284b8..000000000000 --- a/tests/pos-custom-args/strict/i7296.scala +++ /dev/null @@ -1,2 +0,0 @@ -class Foo: - private var blah: Double = 0L \ No newline at end of file diff --git a/tests/pos-special/i7575.scala b/tests/pos-special/i7575.scala deleted file mode 100644 index a2193cf8b4ea..000000000000 --- a/tests/pos-special/i7575.scala +++ /dev/null @@ -1 +0,0 @@ -class Foo() extends Dynamic // tested with -language:dynamics diff --git a/tests/pos/adhoc-extension/A.scala b/tests/pos/adhoc-extension/A.scala new file mode 100644 index 000000000000..c1c0330de254 --- /dev/null +++ b/tests/pos/adhoc-extension/A.scala @@ -0,0 +1,5 @@ +// scalac: -source future -deprecation -Xfatal-warnings + +package adhoc +class A +abstract class Abs diff --git a/tests/pos-custom-args/strict/adhoc-extension/B.scala b/tests/pos/adhoc-extension/B.scala similarity index 100% rename from tests/pos-custom-args/strict/adhoc-extension/B.scala rename to tests/pos/adhoc-extension/B.scala diff --git a/tests/pos/cc-experimental.scala b/tests/pos/cc-experimental.scala new file mode 100644 index 000000000000..bcab127e5c12 --- /dev/null +++ b/tests/pos/cc-experimental.scala @@ -0,0 +1,13 @@ +// scalac: -Yno-experimental + +package scala.runtime + +import language.experimental.captureChecking + +object test: + type T = Pure + +class Foo extends Object, Pure: + val x: Pure = ??? + def foo() = () + diff --git a/tests/pos/dotty-experimental.scala b/tests/pos/dotty-experimental.scala new file mode 100644 index 000000000000..00b5691265a1 --- /dev/null +++ b/tests/pos/dotty-experimental.scala @@ -0,0 +1,8 @@ +// scalac: -Yno-experimental + +import language.experimental.captureChecking +object test { + + val x = caps.cap + +} diff --git a/tests/pos-custom-args/erased/erased-args-lifted.scala b/tests/pos/erased-args-lifted.scala similarity index 82% rename from tests/pos-custom-args/erased/erased-args-lifted.scala rename to tests/pos/erased-args-lifted.scala index faa07cdcb0b5..98948f5ed483 100644 --- a/tests/pos-custom-args/erased/erased-args-lifted.scala +++ b/tests/pos/erased-args-lifted.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def foo(erased a: Int)(b: Int, c: Int) = 42 def bar(i: Int): Int = { diff --git a/tests/pos-custom-args/erased/erased-asInstanceOf.scala b/tests/pos/erased-asInstanceOf.scala similarity index 80% rename from tests/pos-custom-args/erased/erased-asInstanceOf.scala rename to tests/pos/erased-asInstanceOf.scala index 956e325646d9..c08b13232dfc 100644 --- a/tests/pos-custom-args/erased/erased-asInstanceOf.scala +++ b/tests/pos/erased-asInstanceOf.scala @@ -1,3 +1,4 @@ +// scalac: -language:experimental.erasedDefinitions trait Dataset { def select(erased c: Column): Unit = () diff --git a/tests/pos-custom-args/erased/erased-class-as-args.scala b/tests/pos/erased-class-as-args.scala similarity index 90% rename from tests/pos-custom-args/erased/erased-class-as-args.scala rename to tests/pos/erased-class-as-args.scala index 74c827fbd54b..91d8900e6cc2 100644 --- a/tests/pos-custom-args/erased/erased-class-as-args.scala +++ b/tests/pos/erased-class-as-args.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + erased class A erased class B(val x: Int) extends A diff --git a/tests/pos-custom-args/erased/erased-deep-context.scala b/tests/pos/erased-deep-context.scala similarity index 82% rename from tests/pos-custom-args/erased/erased-deep-context.scala rename to tests/pos/erased-deep-context.scala index 049bf14c2e4f..2412b86e5613 100644 --- a/tests/pos-custom-args/erased/erased-deep-context.scala +++ b/tests/pos/erased-deep-context.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def outer1(): Int = { def inner(erased a: Int): Int = 0 diff --git a/tests/pos-custom-args/erased/erased-extension-method.scala b/tests/pos/erased-extension-method.scala similarity index 56% rename from tests/pos-custom-args/erased/erased-extension-method.scala rename to tests/pos/erased-extension-method.scala index 7ef14d65e4a4..c0717be49e7e 100644 --- a/tests/pos-custom-args/erased/erased-extension-method.scala +++ b/tests/pos/erased-extension-method.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + class IntDeco(x: Int) extends AnyVal { def foo(erased y: Int) = x } diff --git a/tests/pos-custom-args/erased/erased-lub-2.scala b/tests/pos/erased-lub-2.scala similarity index 82% rename from tests/pos-custom-args/erased/erased-lub-2.scala rename to tests/pos/erased-lub-2.scala index f0f9b27cc7a4..dad8944ac2eb 100644 --- a/tests/pos-custom-args/erased/erased-lub-2.scala +++ b/tests/pos/erased-lub-2.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + trait Foo trait PF[A, +B] { diff --git a/tests/pos-custom-args/erased/erased-lub.scala b/tests/pos/erased-lub.scala similarity index 89% rename from tests/pos-custom-args/erased/erased-lub.scala rename to tests/pos/erased-lub.scala index d3d2183c123b..8aeabbccdae7 100644 --- a/tests/pos-custom-args/erased/erased-lub.scala +++ b/tests/pos/erased-lub.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + // Verify that expressions below perform correct boxings in erasure. object Test { def id[T](t: T) = t diff --git a/tests/pos-custom-args/erased/erased-soft-keyword.scala b/tests/pos/erased-soft-keyword.scala similarity index 92% rename from tests/pos-custom-args/erased/erased-soft-keyword.scala rename to tests/pos/erased-soft-keyword.scala index fdb884628c7d..c5dc8b0c360c 100644 --- a/tests/pos-custom-args/erased/erased-soft-keyword.scala +++ b/tests/pos/erased-soft-keyword.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + def f1(x: Int, erased y: Int) = 0 def f2(x: Int, erased: Int) = 0 inline def f3(x: Int, inline erased: Int) = 0 diff --git a/tests/pos-custom-args/erased/erased-typedef.scala b/tests/pos/erased-typedef.scala similarity index 70% rename from tests/pos-custom-args/erased/erased-typedef.scala rename to tests/pos/erased-typedef.scala index f4b3e0937664..caa5a639923f 100644 --- a/tests/pos-custom-args/erased/erased-typedef.scala +++ b/tests/pos/erased-typedef.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + trait Monadless[Monad[_]] { type M[T] = Monad[T] diff --git a/tests/pos-custom-args/no-experimental/experimental-imports-empty.scala b/tests/pos/experimental-imports-empty.scala similarity index 85% rename from tests/pos-custom-args/no-experimental/experimental-imports-empty.scala rename to tests/pos/experimental-imports-empty.scala index 998086c5d9a4..a1568c39ae28 100644 --- a/tests/pos-custom-args/no-experimental/experimental-imports-empty.scala +++ b/tests/pos/experimental-imports-empty.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental import language.experimental.namedTypeArguments import language.experimental.genericNumberLiterals diff --git a/tests/pos-custom-args/no-experimental/experimental-imports-top.scala b/tests/pos/experimental-imports-top.scala similarity index 78% rename from tests/pos-custom-args/no-experimental/experimental-imports-top.scala rename to tests/pos/experimental-imports-top.scala index bee89d6ab6c8..20ea119621f4 100644 --- a/tests/pos-custom-args/no-experimental/experimental-imports-top.scala +++ b/tests/pos/experimental-imports-top.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import language.experimental.erasedDefinitions import annotation.experimental diff --git a/tests/pos-special/extend-java-enum.scala b/tests/pos/extend-java-enum.scala similarity index 94% rename from tests/pos-special/extend-java-enum.scala rename to tests/pos/extend-java-enum.scala index 323b6d82639f..351d0e4c74eb 100644 --- a/tests/pos-special/extend-java-enum.scala +++ b/tests/pos/extend-java-enum.scala @@ -1,3 +1,5 @@ +// scalac: -source 3.0-migration + import java.{lang as jl} final class ConfigSyntax private (name: String, ordinal: Int) diff --git a/tests/pos-custom-args/help.scala b/tests/pos/help.scala similarity index 68% rename from tests/pos-custom-args/help.scala rename to tests/pos/help.scala index 257186338e40..7e49f7de0c30 100644 --- a/tests/pos-custom-args/help.scala +++ b/tests/pos/help.scala @@ -1,3 +1,4 @@ +// scalac: -help -V -W -X -Y // dummy source for exercising information flags // diff --git a/tests/pos/i10383.scala b/tests/pos/i10383.scala new file mode 100644 index 000000000000..3a9b44d2774d --- /dev/null +++ b/tests/pos/i10383.scala @@ -0,0 +1,3 @@ +// scalac: -source future -deprecation -Xfatal-warnings + +def r = BigInt(1) to BigInt(3) // error diff --git a/tests/pos-custom-args/erased/i10848a.scala b/tests/pos/i10848a.scala similarity index 59% rename from tests/pos-custom-args/erased/i10848a.scala rename to tests/pos/i10848a.scala index 296937e5e3c2..85fa3328486f 100644 --- a/tests/pos-custom-args/erased/i10848a.scala +++ b/tests/pos/i10848a.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + class IsOn[T] type On object IsOn { diff --git a/tests/pos-custom-args/erased/i10848b.scala b/tests/pos/i10848b.scala similarity index 60% rename from tests/pos-custom-args/erased/i10848b.scala rename to tests/pos/i10848b.scala index 71292b1b859c..429e718b84b1 100644 --- a/tests/pos-custom-args/erased/i10848b.scala +++ b/tests/pos/i10848b.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + class Foo: erased given Int = 1 def foo(using erased x: Int): Unit = () diff --git a/tests/pos-custom-args/erased/i11896.scala b/tests/pos/i11896.scala similarity index 100% rename from tests/pos-custom-args/erased/i11896.scala rename to tests/pos/i11896.scala diff --git a/tests/pos-custom-args/i13044.scala b/tests/pos/i13044.scala similarity index 97% rename from tests/pos-custom-args/i13044.scala rename to tests/pos/i13044.scala index 33a20b5800c8..d24b333c480c 100644 --- a/tests/pos-custom-args/i13044.scala +++ b/tests/pos/i13044.scala @@ -1,3 +1,5 @@ +// scalac: -Xmax-inlines:33 + import scala.deriving.Mirror import scala.compiletime._ diff --git a/tests/pos-custom-args/no-experimental/i13848.scala b/tests/pos/i13848.scala similarity index 76% rename from tests/pos-custom-args/no-experimental/i13848.scala rename to tests/pos/i13848.scala index 8b65ccb078e1..06f067889d2d 100644 --- a/tests/pos-custom-args/no-experimental/i13848.scala +++ b/tests/pos/i13848.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import annotation.experimental @main diff --git a/tests/pos-custom-args/no-experimental/i15133a.scala b/tests/pos/i15133a.scala similarity index 84% rename from tests/pos-custom-args/no-experimental/i15133a.scala rename to tests/pos/i15133a.scala index c7f55f7838c7..1dc8d489081e 100644 --- a/tests/pos-custom-args/no-experimental/i15133a.scala +++ b/tests/pos/i15133a.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/pos-custom-args/no-experimental/i15133b.scala b/tests/pos/i15133b.scala similarity index 84% rename from tests/pos-custom-args/no-experimental/i15133b.scala rename to tests/pos/i15133b.scala index d14d6e84cf6e..111f55dea29f 100644 --- a/tests/pos-custom-args/no-experimental/i15133b.scala +++ b/tests/pos/i15133b.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental @experimental diff --git a/tests/pos-custom-args/no-experimental/i16091.scala b/tests/pos/i16091.scala similarity index 82% rename from tests/pos-custom-args/no-experimental/i16091.scala rename to tests/pos/i16091.scala index 0324aeacccc9..ac752064e70e 100644 --- a/tests/pos-custom-args/no-experimental/i16091.scala +++ b/tests/pos/i16091.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + import scala.annotation.experimental object Macro { diff --git a/tests/pos/i16808.scala b/tests/pos/i16808.scala new file mode 100644 index 000000000000..6b813c13818c --- /dev/null +++ b/tests/pos/i16808.scala @@ -0,0 +1,4 @@ +// scalac: -source future -deprecation -Xfatal-warnings + +def collectKeys[A, B, C](xs: Map[A, B])(f: PartialFunction[A, C]): Map[C, B] = + xs.collect{ case (f(c) , b) => (c, b) } diff --git a/tests/pos/i7296.scala b/tests/pos/i7296.scala new file mode 100644 index 000000000000..39f389729cc5 --- /dev/null +++ b/tests/pos/i7296.scala @@ -0,0 +1,4 @@ +// scalac: -source future -deprecation -Xfatal-warnings + +class Foo: + private var blah: Double = 0L diff --git a/tests/pos/i7575.scala b/tests/pos/i7575.scala new file mode 100644 index 000000000000..c3689afb6441 --- /dev/null +++ b/tests/pos/i7575.scala @@ -0,0 +1,3 @@ +// scalac: -language:dynamics + +class Foo() extends Dynamic diff --git a/tests/pos-custom-args/erased/i7868.scala b/tests/pos/i7868.scala similarity index 96% rename from tests/pos-custom-args/erased/i7868.scala rename to tests/pos/i7868.scala index 02d6ad0e7ca6..a5d844414fb1 100644 --- a/tests/pos-custom-args/erased/i7868.scala +++ b/tests/pos/i7868.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + import language.experimental.namedTypeArguments import scala.compiletime.* import scala.compiletime.ops.int.* diff --git a/tests/pos-custom-args/erased/i7878.scala b/tests/pos/i7878.scala similarity index 86% rename from tests/pos-custom-args/erased/i7878.scala rename to tests/pos/i7878.scala index 63b082d52ca0..b3fd8a77fbfc 100644 --- a/tests/pos-custom-args/erased/i7878.scala +++ b/tests/pos/i7878.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Boom { import scala.compiletime.* trait Fail[A <: Int, B <: Int] diff --git a/tests/pos-custom-args/i8875.scala b/tests/pos/i8875.scala similarity index 67% rename from tests/pos-custom-args/i8875.scala rename to tests/pos/i8875.scala index ac5e0bd5cf42..bb50cd031847 100644 --- a/tests/pos-custom-args/i8875.scala +++ b/tests/pos/i8875.scala @@ -1,3 +1,5 @@ +// scalac: -Xprint:getters + class A { extension (a: Int) { def foo: Int = 1 diff --git a/tests/pos-custom-args/no-experimental/i8945.scala b/tests/pos/i8945.scala similarity index 93% rename from tests/pos-custom-args/no-experimental/i8945.scala rename to tests/pos/i8945.scala index 5dded16f0160..a619bbf6be74 100644 --- a/tests/pos-custom-args/no-experimental/i8945.scala +++ b/tests/pos/i8945.scala @@ -1,3 +1,5 @@ +// scalac: -Yno-experimental + // src-2/MacroImpl.scala trait Context { object universe { diff --git a/tests/pos/i9267.scala b/tests/pos/i9267.scala new file mode 100644 index 000000000000..c92fd043f1aa --- /dev/null +++ b/tests/pos/i9267.scala @@ -0,0 +1,3 @@ +// scalac: -Ystop-after:erasure + +class A diff --git a/tests/pos-custom-args/jdk-8-app.scala b/tests/pos/jdk-8-app.scala similarity index 78% rename from tests/pos-custom-args/jdk-8-app.scala rename to tests/pos/jdk-8-app.scala index 6a9d07155958..8d140691e375 100644 --- a/tests/pos-custom-args/jdk-8-app.scala +++ b/tests/pos/jdk-8-app.scala @@ -1,3 +1,5 @@ +// scalac: -release:8 + import java.time.LocalDate object Jdk8App extends App { diff --git a/tests/pos-special/kind-projector-underscores.scala b/tests/pos/kind-projector-underscores.scala similarity index 98% rename from tests/pos-special/kind-projector-underscores.scala rename to tests/pos/kind-projector-underscores.scala index 06face862e53..2e40c639b01d 100644 --- a/tests/pos-special/kind-projector-underscores.scala +++ b/tests/pos/kind-projector-underscores.scala @@ -1,3 +1,5 @@ +// scalac: -Ykind-projector:underscores + package kind_projector trait Foo[F[_]] diff --git a/tests/pos-special/kind-projector.scala b/tests/pos/kind-projector.scala similarity index 98% rename from tests/pos-special/kind-projector.scala rename to tests/pos/kind-projector.scala index 9048ae90f41c..e7b864c5357e 100644 --- a/tests/pos-special/kind-projector.scala +++ b/tests/pos/kind-projector.scala @@ -1,3 +1,5 @@ +// scalac: -Ykind-projector + package kind_projector trait Foo[F[_]] diff --git a/tests/pos-custom-args/erased/tailrec.scala b/tests/pos/tailrec.scala similarity index 87% rename from tests/pos-custom-args/erased/tailrec.scala rename to tests/pos/tailrec.scala index cebcf4785c7a..d461e1872384 100644 --- a/tests/pos-custom-args/erased/tailrec.scala +++ b/tests/pos/tailrec.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + import scala.annotation.tailrec erased class Foo1 diff --git a/tests/pos-special/typeclass-scaling.scala b/tests/pos/typeclass-scaling.scala similarity index 99% rename from tests/pos-special/typeclass-scaling.scala rename to tests/pos/typeclass-scaling.scala index 4b809de664f3..6f837a2b423b 100644 --- a/tests/pos-special/typeclass-scaling.scala +++ b/tests/pos/typeclass-scaling.scala @@ -1,3 +1,5 @@ +// scalac: -Xmax-inlines 40 + import scala.collection.mutable import scala.annotation.tailrec diff --git a/tests/pos/xfatalWarnings.scala b/tests/pos/xfatalWarnings.scala new file mode 100644 index 000000000000..9cda8e2beed8 --- /dev/null +++ b/tests/pos/xfatalWarnings.scala @@ -0,0 +1,14 @@ +// scalac: -nowarn -Xfatal-warnings +// succeeds despite -Xfatal-warnings because of -nowarn + +object xfatalWarnings { + val opt:Option[String] = Some("test") + + opt match { // error when running with -Xfatal-warnings + case None => + } + + object Test { + while (true) {} // should be ok. no "pure expression does nothing in statement position" issued. + } +} diff --git a/tests/run-custom-args/erased/erased-23.check b/tests/run-custom-args/erased/erased-23.check deleted file mode 100644 index efbbe4dddf06..000000000000 --- a/tests/run-custom-args/erased/erased-23.check +++ /dev/null @@ -1,2 +0,0 @@ -lambda1 -lambda2 diff --git a/tests/run-custom-args/erased/quotes-reflection.check b/tests/run-custom-args/erased/quotes-reflection.check deleted file mode 100644 index 584714624b45..000000000000 --- a/tests/run-custom-args/erased/quotes-reflection.check +++ /dev/null @@ -1,10 +0,0 @@ -method : () isGiven=false isImplicit=false erasedArgs=List() -method m1: (i: scala.Int) isGiven=true isImplicit=false erasedArgs=List(false) -method m2: (i: scala.Int) isGiven=false isImplicit=false erasedArgs=List(true) -method m3: (i: scala.Int, j: scala.Int) isGiven=false isImplicit=false erasedArgs=List(false, true) -method m4: (i: EC) isGiven=false isImplicit=false erasedArgs=List(true) -val l1: scala.ContextFunction1[scala.Int, scala.Int] -val l2: scala.runtime.ErasedFunction with apply: (x: scala.Int @scala.annotation.internal.ErasedParam) isImplicit=false erasedParams=List(true) -val l3: scala.runtime.ErasedFunction with apply: (x: scala.Int @scala.annotation.internal.ErasedParam) isImplicit=true erasedParams=List(true) -val l4: scala.runtime.ErasedFunction with apply: (x: scala.Int, y: scala.Int @scala.annotation.internal.ErasedParam) isImplicit=false erasedParams=List(false, true) -val l5: scala.runtime.ErasedFunction with apply: (x: EC @scala.annotation.internal.ErasedParam) isImplicit=false erasedParams=List(true) diff --git a/tests/run-custom-args/fatal-warnings/convertible.check b/tests/run/convertible.check similarity index 100% rename from tests/run-custom-args/fatal-warnings/convertible.check rename to tests/run/convertible.check diff --git a/tests/run-custom-args/fatal-warnings/convertible.scala b/tests/run/convertible.scala similarity index 95% rename from tests/run-custom-args/fatal-warnings/convertible.scala rename to tests/run/convertible.scala index 3479f53df3c8..6c199c564d52 100644 --- a/tests/run-custom-args/fatal-warnings/convertible.scala +++ b/tests/run/convertible.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import language.experimental.into class Text(val str: String) diff --git a/tests/run-custom-args/defaults-serizaliable-no-forwarders.scala b/tests/run/defaults-serizaliable-no-forwarders.scala similarity index 93% rename from tests/run-custom-args/defaults-serizaliable-no-forwarders.scala rename to tests/run/defaults-serizaliable-no-forwarders.scala index b2762cf443bc..5ecdb3b41c57 100644 --- a/tests/run-custom-args/defaults-serizaliable-no-forwarders.scala +++ b/tests/run/defaults-serizaliable-no-forwarders.scala @@ -1,3 +1,6 @@ +// scalac: -Xmixin-force-forwarders:false +// scalajs: --skip + import java.io.{ByteArrayInputStream, ByteArrayOutputStream, ObjectInputStream, ObjectOutputStream} trait T1 extends Serializable { diff --git a/tests/run-custom-args/erased/erased-1.check b/tests/run/erased-1.check similarity index 100% rename from tests/run-custom-args/erased/erased-1.check rename to tests/run/erased-1.check diff --git a/tests/run-custom-args/erased/erased-1.scala b/tests/run/erased-1.scala similarity index 77% rename from tests/run-custom-args/erased/erased-1.scala rename to tests/run/erased-1.scala index acb8ce68f9bf..be73e57ff9c5 100644 --- a/tests/run-custom-args/erased/erased-1.scala +++ b/tests/run/erased-1.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-10.check b/tests/run/erased-10.check similarity index 100% rename from tests/run-custom-args/erased/erased-10.check rename to tests/run/erased-10.check diff --git a/tests/run-custom-args/erased/erased-10.scala b/tests/run/erased-10.scala similarity index 84% rename from tests/run-custom-args/erased/erased-10.scala rename to tests/run/erased-10.scala index 25c86c0267c8..2954b923bab6 100644 --- a/tests/run-custom-args/erased/erased-10.scala +++ b/tests/run/erased-10.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-11.check b/tests/run/erased-11.check similarity index 100% rename from tests/run-custom-args/erased/erased-11.check rename to tests/run/erased-11.check diff --git a/tests/run-custom-args/erased/erased-11.scala b/tests/run/erased-11.scala similarity index 91% rename from tests/run-custom-args/erased/erased-11.scala rename to tests/run/erased-11.scala index 36a8d08f8d7f..a3490af973e1 100644 --- a/tests/run-custom-args/erased/erased-11.scala +++ b/tests/run/erased-11.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-12.check b/tests/run/erased-12.check similarity index 100% rename from tests/run-custom-args/erased/erased-12.check rename to tests/run/erased-12.check diff --git a/tests/run-custom-args/erased/erased-12.scala b/tests/run/erased-12.scala similarity index 80% rename from tests/run-custom-args/erased/erased-12.scala rename to tests/run/erased-12.scala index cde677050dd6..9f60594137d0 100644 --- a/tests/run-custom-args/erased/erased-12.scala +++ b/tests/run/erased-12.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-13.check b/tests/run/erased-13.check similarity index 100% rename from tests/run-custom-args/erased/erased-13.check rename to tests/run/erased-13.check diff --git a/tests/run-custom-args/erased/erased-13.scala b/tests/run/erased-13.scala similarity index 77% rename from tests/run-custom-args/erased/erased-13.scala rename to tests/run/erased-13.scala index 442a3eab4c01..c49e003330b9 100644 --- a/tests/run-custom-args/erased/erased-13.scala +++ b/tests/run/erased-13.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-14.check b/tests/run/erased-14.check similarity index 100% rename from tests/run-custom-args/erased/erased-14.check rename to tests/run/erased-14.check diff --git a/tests/run-custom-args/erased/erased-14.scala b/tests/run/erased-14.scala similarity index 75% rename from tests/run-custom-args/erased/erased-14.scala rename to tests/run/erased-14.scala index 6486ba8085c4..07b0ede25807 100644 --- a/tests/run-custom-args/erased/erased-14.scala +++ b/tests/run/erased-14.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-15.check b/tests/run/erased-15.check similarity index 100% rename from tests/run-custom-args/erased/erased-15.check rename to tests/run/erased-15.check diff --git a/tests/run-custom-args/erased/erased-15.scala b/tests/run/erased-15.scala similarity index 71% rename from tests/run-custom-args/erased/erased-15.scala rename to tests/run/erased-15.scala index 02b70f9125d6..282c5510c51a 100644 --- a/tests/run-custom-args/erased/erased-15.scala +++ b/tests/run/erased-15.scala @@ -1,4 +1,4 @@ -import scala.runtime.ErasedFunction +// scalac: -language:experimental.erasedDefinitions object Test { @@ -12,7 +12,7 @@ object Test { } } -class Foo extends ErasedFunction { +class Foo extends PolyFunction { def apply(erased x: Int): Int = { println("Foo.apply") 42 diff --git a/tests/run-custom-args/erased/erased-16.check b/tests/run/erased-16.check similarity index 100% rename from tests/run-custom-args/erased/erased-16.check rename to tests/run/erased-16.check diff --git a/tests/run-custom-args/erased/erased-16.scala b/tests/run/erased-16.scala similarity index 84% rename from tests/run-custom-args/erased/erased-16.scala rename to tests/run/erased-16.scala index 879af76765b7..8549a4344351 100644 --- a/tests/run-custom-args/erased/erased-16.scala +++ b/tests/run/erased-16.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-17.check b/tests/run/erased-17.check similarity index 100% rename from tests/run-custom-args/erased/erased-17.check rename to tests/run/erased-17.check diff --git a/tests/run-custom-args/erased/erased-17.scala b/tests/run/erased-17.scala similarity index 79% rename from tests/run-custom-args/erased/erased-17.scala rename to tests/run/erased-17.scala index 9b9dbea70264..9857a7a77a95 100644 --- a/tests/run-custom-args/erased/erased-17.scala +++ b/tests/run/erased-17.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-18.check b/tests/run/erased-18.check similarity index 100% rename from tests/run-custom-args/erased/erased-18.check rename to tests/run/erased-18.check diff --git a/tests/run-custom-args/erased/erased-18.scala b/tests/run/erased-18.scala similarity index 78% rename from tests/run-custom-args/erased/erased-18.scala rename to tests/run/erased-18.scala index c53d89113a3a..146537389990 100644 --- a/tests/run-custom-args/erased/erased-18.scala +++ b/tests/run/erased-18.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-19.check b/tests/run/erased-19.check similarity index 100% rename from tests/run-custom-args/erased/erased-19.check rename to tests/run/erased-19.check diff --git a/tests/run-custom-args/erased/erased-19.scala b/tests/run/erased-19.scala similarity index 69% rename from tests/run-custom-args/erased/erased-19.scala rename to tests/run/erased-19.scala index ff6a05f7de3d..114abf2eb42c 100644 --- a/tests/run-custom-args/erased/erased-19.scala +++ b/tests/run/erased-19.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-20.check b/tests/run/erased-20.check similarity index 100% rename from tests/run-custom-args/erased/erased-20.check rename to tests/run/erased-20.check diff --git a/tests/run-custom-args/erased/erased-20.scala b/tests/run/erased-20.scala similarity index 78% rename from tests/run-custom-args/erased/erased-20.scala rename to tests/run/erased-20.scala index f54fd417eb83..0d92636b7acb 100644 --- a/tests/run-custom-args/erased/erased-20.scala +++ b/tests/run/erased-20.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-21.check b/tests/run/erased-21.check similarity index 100% rename from tests/run-custom-args/erased/erased-21.check rename to tests/run/erased-21.check diff --git a/tests/run-custom-args/erased/erased-21.scala b/tests/run/erased-21.scala similarity index 79% rename from tests/run-custom-args/erased/erased-21.scala rename to tests/run/erased-21.scala index a85c6ea62f98..e64ddda8f778 100644 --- a/tests/run-custom-args/erased/erased-21.scala +++ b/tests/run/erased-21.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { type UU[T] = (erased T) => Int diff --git a/tests/run-custom-args/erased/erased-22.check b/tests/run/erased-22.check similarity index 100% rename from tests/run-custom-args/erased/erased-22.check rename to tests/run/erased-22.check diff --git a/tests/run-custom-args/erased/erased-22.scala b/tests/run/erased-22.scala similarity index 81% rename from tests/run-custom-args/erased/erased-22.scala rename to tests/run/erased-22.scala index 954b67604eb6..7a92c9686f04 100644 --- a/tests/run-custom-args/erased/erased-22.scala +++ b/tests/run/erased-22.scala @@ -1,3 +1,4 @@ +// scalac: -language:experimental.erasedDefinitions object Test { diff --git a/tests/run-custom-args/erased/erased-25.check b/tests/run/erased-25.check similarity index 100% rename from tests/run-custom-args/erased/erased-25.check rename to tests/run/erased-25.check diff --git a/tests/run-custom-args/erased/erased-25.scala b/tests/run/erased-25.scala similarity index 79% rename from tests/run-custom-args/erased/erased-25.scala rename to tests/run/erased-25.scala index 97a85dd1460d..6ba06bc7cffa 100644 --- a/tests/run-custom-args/erased/erased-25.scala +++ b/tests/run/erased-25.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { val ds: Dataset = new Dataset diff --git a/tests/run-custom-args/erased/erased-26.check b/tests/run/erased-26.check similarity index 100% rename from tests/run-custom-args/erased/erased-26.check rename to tests/run/erased-26.check diff --git a/tests/run-custom-args/erased/erased-26.scala b/tests/run/erased-26.scala similarity index 73% rename from tests/run-custom-args/erased/erased-26.scala rename to tests/run/erased-26.scala index eed903ac2753..0ebc117e84d2 100644 --- a/tests/run-custom-args/erased/erased-26.scala +++ b/tests/run/erased-26.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { col("abc")(true) diff --git a/tests/run-custom-args/erased/erased-27.check b/tests/run/erased-27.check similarity index 100% rename from tests/run-custom-args/erased/erased-27.check rename to tests/run/erased-27.check diff --git a/tests/run-custom-args/erased/erased-27.scala b/tests/run/erased-27.scala similarity index 80% rename from tests/run-custom-args/erased/erased-27.scala rename to tests/run/erased-27.scala index 68b551520daa..86faa3a4f0f3 100644 --- a/tests/run-custom-args/erased/erased-27.scala +++ b/tests/run/erased-27.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { ({ diff --git a/tests/run-custom-args/erased/erased-28.check b/tests/run/erased-28.check similarity index 100% rename from tests/run-custom-args/erased/erased-28.check rename to tests/run/erased-28.check diff --git a/tests/run-custom-args/erased/erased-28.scala b/tests/run/erased-28.scala similarity index 85% rename from tests/run-custom-args/erased/erased-28.scala rename to tests/run/erased-28.scala index 8b916b810dff..7081ec779402 100644 --- a/tests/run-custom-args/erased/erased-28.scala +++ b/tests/run/erased-28.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { var a = true def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-3.check b/tests/run/erased-3.check similarity index 100% rename from tests/run-custom-args/erased/erased-3.check rename to tests/run/erased-3.check diff --git a/tests/run-custom-args/erased/erased-3.scala b/tests/run/erased-3.scala similarity index 83% rename from tests/run-custom-args/erased/erased-3.scala rename to tests/run/erased-3.scala index 68d2f8b629c2..aad90ef06fd7 100644 --- a/tests/run-custom-args/erased/erased-3.scala +++ b/tests/run/erased-3.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-4.check b/tests/run/erased-4.check similarity index 100% rename from tests/run-custom-args/erased/erased-4.check rename to tests/run/erased-4.check diff --git a/tests/run-custom-args/erased/erased-4.scala b/tests/run/erased-4.scala similarity index 87% rename from tests/run-custom-args/erased/erased-4.scala rename to tests/run/erased-4.scala index 8725a7ebc00f..7650b6b513e9 100644 --- a/tests/run-custom-args/erased/erased-4.scala +++ b/tests/run/erased-4.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-5.check b/tests/run/erased-5.check similarity index 100% rename from tests/run-custom-args/erased/erased-5.check rename to tests/run/erased-5.check diff --git a/tests/run-custom-args/erased/erased-5.scala b/tests/run/erased-5.scala similarity index 88% rename from tests/run-custom-args/erased/erased-5.scala rename to tests/run/erased-5.scala index 043d1a4781a7..ef813440576f 100644 --- a/tests/run-custom-args/erased/erased-5.scala +++ b/tests/run/erased-5.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-6.check b/tests/run/erased-6.check similarity index 100% rename from tests/run-custom-args/erased/erased-6.check rename to tests/run/erased-6.check diff --git a/tests/run-custom-args/erased/erased-6.scala b/tests/run/erased-6.scala similarity index 77% rename from tests/run-custom-args/erased/erased-6.scala rename to tests/run/erased-6.scala index ec113fbb426b..c1c2377175de 100644 --- a/tests/run-custom-args/erased/erased-6.scala +++ b/tests/run/erased-6.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-7.check b/tests/run/erased-7.check similarity index 100% rename from tests/run-custom-args/erased/erased-7.check rename to tests/run/erased-7.check diff --git a/tests/run-custom-args/erased/erased-7.scala b/tests/run/erased-7.scala similarity index 81% rename from tests/run-custom-args/erased/erased-7.scala rename to tests/run/erased-7.scala index 6027c2e1572c..8eca420c9768 100644 --- a/tests/run-custom-args/erased/erased-7.scala +++ b/tests/run/erased-7.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-8.check b/tests/run/erased-8.check similarity index 100% rename from tests/run-custom-args/erased/erased-8.check rename to tests/run/erased-8.check diff --git a/tests/run-custom-args/erased/erased-8.scala b/tests/run/erased-8.scala similarity index 81% rename from tests/run-custom-args/erased/erased-8.scala rename to tests/run/erased-8.scala index afa637e709ef..ae2b79cd8544 100644 --- a/tests/run-custom-args/erased/erased-8.scala +++ b/tests/run/erased-8.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-9.check b/tests/run/erased-9.check similarity index 100% rename from tests/run-custom-args/erased/erased-9.check rename to tests/run/erased-9.check diff --git a/tests/run-custom-args/erased/erased-9.scala b/tests/run/erased-9.scala similarity index 77% rename from tests/run-custom-args/erased/erased-9.scala rename to tests/run/erased-9.scala index a989bce068a2..01ae56f4ec79 100644 --- a/tests/run-custom-args/erased/erased-9.scala +++ b/tests/run/erased-9.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-class-are-erased.check b/tests/run/erased-class-are-erased.check similarity index 100% rename from tests/run-custom-args/erased/erased-class-are-erased.check rename to tests/run/erased-class-are-erased.check diff --git a/tests/run-custom-args/erased/erased-class-are-erased.scala b/tests/run/erased-class-are-erased.scala similarity index 82% rename from tests/run-custom-args/erased/erased-class-are-erased.scala rename to tests/run/erased-class-are-erased.scala index b48e0265c521..e91019e9eabb 100644 --- a/tests/run-custom-args/erased/erased-class-are-erased.scala +++ b/tests/run/erased-class-are-erased.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { erased class Erased() { println("Oh no!!!") diff --git a/tests/run-custom-args/erased/erased-frameless.check b/tests/run/erased-frameless.check similarity index 100% rename from tests/run-custom-args/erased/erased-frameless.check rename to tests/run/erased-frameless.check diff --git a/tests/run-custom-args/erased/erased-frameless.scala b/tests/run/erased-frameless.scala similarity index 98% rename from tests/run-custom-args/erased/erased-frameless.scala rename to tests/run/erased-frameless.scala index bc52bd4ac8fb..a61f7a025593 100644 --- a/tests/run-custom-args/erased/erased-frameless.scala +++ b/tests/run/erased-frameless.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + import scala.annotation.implicitNotFound // Subset of shapeless diff --git a/tests/run-custom-args/erased/lambdas.scala b/tests/run/erased-lambdas.scala similarity index 92% rename from tests/run-custom-args/erased/lambdas.scala rename to tests/run/erased-lambdas.scala index 4c1746283099..2e0851f4f054 100644 --- a/tests/run-custom-args/erased/lambdas.scala +++ b/tests/run/erased-lambdas.scala @@ -1,3 +1,6 @@ +// scalac: -language:experimental.erasedDefinitions +// scalajs: --skip + // lambdas should parse and work type F = (erased Int, String) => String diff --git a/tests/run-custom-args/erased/erased-machine-state.check b/tests/run/erased-machine-state.check similarity index 100% rename from tests/run-custom-args/erased/erased-machine-state.check rename to tests/run/erased-machine-state.check diff --git a/tests/run-custom-args/erased/erased-machine-state.scala b/tests/run/erased-machine-state.scala similarity index 95% rename from tests/run-custom-args/erased/erased-machine-state.scala rename to tests/run/erased-machine-state.scala index cafe5fa6f1f8..458efd49cc53 100644 --- a/tests/run-custom-args/erased/erased-machine-state.scala +++ b/tests/run/erased-machine-state.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + import scala.annotation.implicitNotFound sealed trait State diff --git a/tests/run-custom-args/erased/erased-poly-ref.check b/tests/run/erased-poly-ref.check similarity index 100% rename from tests/run-custom-args/erased/erased-poly-ref.check rename to tests/run/erased-poly-ref.check diff --git a/tests/run-custom-args/erased/erased-poly-ref.scala b/tests/run/erased-poly-ref.scala similarity index 82% rename from tests/run-custom-args/erased/erased-poly-ref.scala rename to tests/run/erased-poly-ref.scala index 9f0d3c38d417..46932792eb9a 100644 --- a/tests/run-custom-args/erased/erased-poly-ref.scala +++ b/tests/run/erased-poly-ref.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-select-prefix.check b/tests/run/erased-select-prefix.check similarity index 100% rename from tests/run-custom-args/erased/erased-select-prefix.check rename to tests/run/erased-select-prefix.check diff --git a/tests/run-custom-args/erased/erased-select-prefix.scala b/tests/run/erased-select-prefix.scala similarity index 89% rename from tests/run-custom-args/erased/erased-select-prefix.scala rename to tests/run/erased-select-prefix.scala index 718779ccdcfb..e82994a59932 100644 --- a/tests/run-custom-args/erased/erased-select-prefix.scala +++ b/tests/run/erased-select-prefix.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/erased-value-class.check b/tests/run/erased-value-class.check similarity index 100% rename from tests/run-custom-args/erased/erased-value-class.check rename to tests/run/erased-value-class.check diff --git a/tests/run-custom-args/erased/erased-value-class.scala b/tests/run/erased-value-class.scala similarity index 81% rename from tests/run-custom-args/erased/erased-value-class.scala rename to tests/run/erased-value-class.scala index a87b0e8bf4af..918f6af902a3 100644 --- a/tests/run-custom-args/erased/erased-value-class.scala +++ b/tests/run/erased-value-class.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-custom-args/erased/generic-java-signatures-erased.check b/tests/run/generic-java-signatures-erased.check similarity index 100% rename from tests/run-custom-args/erased/generic-java-signatures-erased.check rename to tests/run/generic-java-signatures-erased.check diff --git a/tests/run-custom-args/erased/generic-java-signatures-erased.scala b/tests/run/generic-java-signatures-erased.scala similarity index 84% rename from tests/run-custom-args/erased/generic-java-signatures-erased.scala rename to tests/run/generic-java-signatures-erased.scala index a9731cc748fb..954c98e1ddee 100644 --- a/tests/run-custom-args/erased/generic-java-signatures-erased.scala +++ b/tests/run/generic-java-signatures-erased.scala @@ -1,3 +1,6 @@ +// scalac: -language:experimental.erasedDefinitions +// scalajs: --skip + object MyErased { def f1[U](erased a: Int): Int = 0 } diff --git a/tests/run-custom-args/fatal-warnings/i11050.scala b/tests/run/i11050.scala similarity index 99% rename from tests/run-custom-args/fatal-warnings/i11050.scala rename to tests/run/i11050.scala index f0bdd23031fa..4c275e28195f 100644 --- a/tests/run-custom-args/fatal-warnings/i11050.scala +++ b/tests/run/i11050.scala @@ -1,3 +1,5 @@ +// scalac: -Xfatal-warnings + import scala.compiletime.* import scala.deriving.* diff --git a/tests/run-custom-args/erased/i11996.scala b/tests/run/i11996.scala similarity index 90% rename from tests/run-custom-args/erased/i11996.scala rename to tests/run/i11996.scala index 050d36370ef0..5cf3cfd0f428 100644 --- a/tests/run-custom-args/erased/i11996.scala +++ b/tests/run/i11996.scala @@ -1,3 +1,5 @@ +// scalac: -language:experimental.erasedDefinitions + final class UnivEq[A] object UnivEq: diff --git a/tests/run/i5606.scala b/tests/run/i5606.scala index aedfa0617dfc..1ee6fed27091 100644 --- a/tests/run/i5606.scala +++ b/tests/run/i5606.scala @@ -1,3 +1,5 @@ +// scalac: -Yretain-trees + object Test extends App { extension [A, B](f: A => B) def `$` (a: A): B = f(a) diff --git a/tests/run-custom-args/no-useless-forwarders.scala b/tests/run/no-useless-forwarders.scala similarity index 88% rename from tests/run-custom-args/no-useless-forwarders.scala rename to tests/run/no-useless-forwarders.scala index e3acfb2a18e5..dc465b24ef1e 100644 --- a/tests/run-custom-args/no-useless-forwarders.scala +++ b/tests/run/no-useless-forwarders.scala @@ -1,3 +1,6 @@ +// scalac: -Xmixin-force-forwarders:false +// scalajs: --skip + trait A { def foo(a: Int): Int = a def bar(a: Int): Int diff --git a/tests/run-custom-args/erased/quotes-add-erased.check b/tests/run/quotes-add-erased.check similarity index 100% rename from tests/run-custom-args/erased/quotes-add-erased.check rename to tests/run/quotes-add-erased.check diff --git a/tests/run-custom-args/erased/quotes-add-erased/Macro_1.scala b/tests/run/quotes-add-erased/Macro_1.scala similarity index 100% rename from tests/run-custom-args/erased/quotes-add-erased/Macro_1.scala rename to tests/run/quotes-add-erased/Macro_1.scala diff --git a/tests/run-custom-args/erased/quotes-add-erased/Test_2.scala b/tests/run/quotes-add-erased/Test_2.scala similarity index 100% rename from tests/run-custom-args/erased/quotes-add-erased/Test_2.scala rename to tests/run/quotes-add-erased/Test_2.scala diff --git a/tests/run/quotes-reflection.check b/tests/run/quotes-reflection.check new file mode 100644 index 000000000000..ed01fb47ac5f --- /dev/null +++ b/tests/run/quotes-reflection.check @@ -0,0 +1,10 @@ +method : () isGiven=false isImplicit=false erasedArgs=List() +method m1: (i: scala.Int) isGiven=true isImplicit=false erasedArgs=List(false) +method m2: (i: scala.Int) isGiven=false isImplicit=false erasedArgs=List(true) +method m3: (i: scala.Int, j: scala.Int) isGiven=false isImplicit=false erasedArgs=List(false, true) +method m4: (i: EC) isGiven=false isImplicit=false erasedArgs=List(true) +val l1: scala.ContextFunction1[scala.Int, scala.Int] +val l2: scala.PolyFunction with apply: (x: scala.Int @scala.annotation.internal.ErasedParam) isImplicit=false erasedParams=List(true) +val l3: scala.PolyFunction with apply: (x: scala.Int @scala.annotation.internal.ErasedParam) isImplicit=true erasedParams=List(true) +val l4: scala.PolyFunction with apply: (x: scala.Int, y: scala.Int @scala.annotation.internal.ErasedParam) isImplicit=false erasedParams=List(false, true) +val l5: scala.PolyFunction with apply: (x: EC @scala.annotation.internal.ErasedParam) isImplicit=false erasedParams=List(true) diff --git a/tests/run-custom-args/erased/quotes-reflection/Macros_1.scala b/tests/run/quotes-reflection/Macros_1.scala similarity index 96% rename from tests/run-custom-args/erased/quotes-reflection/Macros_1.scala rename to tests/run/quotes-reflection/Macros_1.scala index f7b1187433f0..5945d39a097a 100644 --- a/tests/run-custom-args/erased/quotes-reflection/Macros_1.scala +++ b/tests/run/quotes-reflection/Macros_1.scala @@ -20,7 +20,7 @@ def inspect2[A: Type](using Quotes): Expr[String] = { s"method $name: $paramStr" case vd @ ValDef(name, tpt, body) => tpt.tpe match - case Refinement(parent, "apply", tpe: MethodType) if parent == defn.ErasedFunctionClass.typeRef => + case Refinement(parent, "apply", tpe: MethodType) if parent == defn.PolyFunctionClass.typeRef => assert(tpt.tpe.isErasedFunctionType) val params = tpe.paramNames.zip(tpe.paramTypes).map((n, t) => s"$n: ${t.show}").mkString("(", ", ", ")") diff --git a/tests/run-custom-args/erased/quotes-reflection/Test_2.scala b/tests/run/quotes-reflection/Test_2.scala similarity index 100% rename from tests/run-custom-args/erased/quotes-reflection/Test_2.scala rename to tests/run/quotes-reflection/Test_2.scala