Skip to content

Commit 67e6dba

Browse files
authored
Simplify tests with custom args in CompilationTests (#18376)
2 parents 37a0750 + 289fdb8 commit 67e6dba

File tree

408 files changed

+857
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

408 files changed

+857
-377
lines changed

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,12 @@ class CompilationTests {
4242
compileFilesInDir("tests/new", defaultOptions.and("-source", "3.2")), // just to see whether 3.2 works
4343
compileFilesInDir("tests/pos-scala2", scala2CompatMode),
4444
compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
45-
compileFilesInDir("tests/pos-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")),
4645
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")),
4746
// Run tests for legacy lazy vals
4847
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)),
4948
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),
50-
compileFilesInDir("tests/pos-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")),
51-
compileFilesInDir("tests/pos-custom-args/strict", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
5249
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
5350
compileDir("tests/pos-special/stdlib", defaultOptions),
54-
compileFile(
55-
// succeeds despite -Xfatal-warnings because of -nowarn
56-
"tests/neg-custom-args/fatal-warnings/xfatalWarnings.scala",
57-
defaultOptions.and("-nowarn", "-Xfatal-warnings")
58-
),
59-
compileFile("tests/pos-special/typeclass-scaling.scala", defaultOptions.and("-Xmax-inlines", "40")),
60-
compileFile("tests/pos-special/i7575.scala", defaultOptions.andLanguageFeature("dynamics")),
61-
compileFile("tests/pos-special/kind-projector.scala", defaultOptions.and("-Ykind-projector")),
62-
compileFile("tests/pos-special/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")),
63-
compileFile("tests/run/i5606.scala", defaultOptions.and("-Yretain-trees")),
64-
compileFile("tests/pos-custom-args/i8875.scala", defaultOptions.and("-Xprint:getters")),
65-
compileFile("tests/pos-custom-args/i9267.scala", defaultOptions.and("-Ystop-after:erasure")),
66-
compileFile("tests/pos-special/extend-java-enum.scala", defaultOptions.and("-source", "3.0-migration")),
67-
compileFile("tests/pos-custom-args/help.scala", defaultOptions.and("-help", "-V", "-W", "-X", "-Y")),
68-
compileFile("tests/pos-custom-args/i13044.scala", defaultOptions.and("-Xmax-inlines:33")),
69-
compileFile("tests/pos-custom-args/jdk-8-app.scala", defaultOptions.and("-release:8"))
7051
)
7152

7253
if scala.util.Properties.isJavaAtLeast("16") then
@@ -142,29 +123,14 @@ class CompilationTests {
142123
compileFilesInDir("tests/neg", defaultOptions),
143124
compileFilesInDir("tests/neg-tailcall", defaultOptions),
144125
compileFilesInDir("tests/neg-strict", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
145-
compileFilesInDir("tests/neg-no-kind-polymorphism", defaultOptions and "-Yno-kind-polymorphism"),
146-
compileFilesInDir("tests/neg-custom-args/deprecation", defaultOptions.and("-Xfatal-warnings", "-deprecation")),
147-
compileFilesInDir("tests/neg-custom-args/fatal-warnings", defaultOptions.and("-Xfatal-warnings")),
148-
compileFilesInDir("tests/neg-custom-args/nowarn", defaultOptions.and("-deprecation", "-Wunused:nowarn", "-Wconf:msg=@nowarn annotation does not suppress any warnings:e")),
149-
compileFilesInDir("tests/neg-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")),
150126
compileFilesInDir("tests/neg-custom-args/allow-double-bindings", allowDoubleBindings),
151127
compileFilesInDir("tests/neg-custom-args/allow-deep-subtypes", allowDeepSubtypes),
152-
compileFilesInDir("tests/neg-custom-args/feature", defaultOptions.and("-Xfatal-warnings", "-feature")),
153-
compileFilesInDir("tests/neg-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")),
154128
compileFilesInDir("tests/neg-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
155-
compileFilesInDir("tests/neg-custom-args/explain", defaultOptions.and("-explain")),
156-
compileFile("tests/neg-custom-args/avoid-warn-deprecation.scala", defaultOptions.and("-Xfatal-warnings", "-feature")),
157-
compileFile("tests/neg-custom-args/i3246.scala", scala2CompatMode),
158-
compileFile("tests/neg-custom-args/overrideClass.scala", scala2CompatMode),
159-
compileFile("tests/neg-custom-args/ovlazy.scala", scala2CompatMode.and("-Xfatal-warnings")),
160-
compileFile("tests/neg-custom-args/newline-braces.scala", scala2CompatMode.and("-Xfatal-warnings")),
161-
compileFile("tests/neg-custom-args/autoTuplingTest.scala", defaultOptions.andLanguageFeature("noAutoTupling")),
162129
compileFile("tests/neg-custom-args/i1650.scala", allowDeepSubtypes),
163130
compileFile("tests/neg-custom-args/i3882.scala", allowDeepSubtypes),
164131
compileFile("tests/neg-custom-args/i4372.scala", allowDeepSubtypes),
165132
compileFile("tests/neg-custom-args/i1754.scala", allowDeepSubtypes),
166133
compileFile("tests/neg-custom-args/i12650.scala", allowDeepSubtypes),
167-
compileFile("tests/neg-custom-args/i9517.scala", defaultOptions.and("-Xprint-types")),
168134
compileFile("tests/neg-custom-args/interop-polytypes.scala", allowDeepSubtypes.and("-Yexplicit-nulls")),
169135
compileFile("tests/neg-custom-args/conditionalWarnings.scala", allowDeepSubtypes.and("-deprecation").and("-Xfatal-warnings")),
170136
compileFilesInDir("tests/neg-custom-args/isInstanceOf", allowDeepSubtypes and "-Xfatal-warnings"),
@@ -176,23 +142,7 @@ class CompilationTests {
176142
"tests/neg-custom-args/toplevel-samesource/nested/S.scala"),
177143
defaultOptions),
178144
compileFile("tests/neg-custom-args/i6300.scala", allowDeepSubtypes),
179-
compileFile("tests/neg-custom-args/infix.scala", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
180-
compileFile("tests/neg-custom-args/missing-targetName.scala", defaultOptions.and("-Yrequire-targetName", "-Xfatal-warnings")),
181-
compileFile("tests/neg-custom-args/wildcards.scala", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
182-
compileFile("tests/neg-custom-args/indentRight.scala", defaultOptions.and("-no-indent", "-Xfatal-warnings")),
183-
compileDir("tests/neg-custom-args/adhoc-extension", defaultOptions.and("-source", "future", "-feature", "-Xfatal-warnings")),
184145
compileFile("tests/neg/i7575.scala", defaultOptions.withoutLanguageFeatures.and("-language:_")),
185-
compileFile("tests/neg-custom-args/kind-projector.scala", defaultOptions.and("-Ykind-projector")),
186-
compileFile("tests/neg-custom-args/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")),
187-
compileFile("tests/neg-custom-args/typeclass-derivation2.scala", defaultOptions.and("-language:experimental.erasedDefinitions")),
188-
compileFile("tests/neg-custom-args/deptypes.scala", defaultOptions.and("-language:experimental.dependent")),
189-
compileFile("tests/neg-custom-args/matchable.scala", defaultOptions.and("-Xfatal-warnings", "-source", "future")),
190-
compileFile("tests/neg-custom-args/i7314.scala", defaultOptions.and("-Xfatal-warnings", "-source", "future")),
191-
compileFile("tests/neg-custom-args/capt-wf.scala", defaultOptions.and("-language:experimental.captureChecking", "-Xfatal-warnings")),
192-
compileFile("tests/neg-custom-args/i13026.scala", defaultOptions.and("-print-lines")),
193-
compileFile("tests/neg-custom-args/i13838.scala", defaultOptions.and("-Ximplicit-search-limit", "1000")),
194-
compileFile("tests/neg-custom-args/jdk-9-app.scala", defaultOptions.and("-release:8")),
195-
compileFile("tests/neg-custom-args/i10994.scala", defaultOptions.and("-source", "future")),
196146
).checkExpectedErrors()
197147
}
198148

@@ -209,10 +159,6 @@ class CompilationTests {
209159
compileFile("tests/run-custom-args/typeclass-derivation1.scala", defaultOptions.without(yCheckOptions*)),
210160
compileFile("tests/run-custom-args/tuple-cons.scala", allowDeepSubtypes),
211161
compileFile("tests/run-custom-args/i5256.scala", allowDeepSubtypes),
212-
compileFile("tests/run-custom-args/no-useless-forwarders.scala", defaultOptions and "-Xmixin-force-forwarders:false"),
213-
compileFile("tests/run-custom-args/defaults-serizaliable-no-forwarders.scala", defaultOptions and "-Xmixin-force-forwarders:false"),
214-
compileFilesInDir("tests/run-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")),
215-
compileFilesInDir("tests/run-custom-args/fatal-warnings", defaultOptions.and("-Xfatal-warnings")),
216162
compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking")),
217163
compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes),
218164
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init")),
@@ -254,7 +200,6 @@ class CompilationTests {
254200
implicit val testGroup: TestGroup = TestGroup("explicitNullsNeg")
255201
aggregateTests(
256202
compileFilesInDir("tests/explicit-nulls/neg", explicitNullsOptions),
257-
compileFilesInDir("tests/explicit-nulls/neg-patmat", explicitNullsOptions and "-Xfatal-warnings"),
258203
compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions),
259204
)
260205
}.checkExpectedErrors()
@@ -263,11 +208,7 @@ class CompilationTests {
263208
implicit val testGroup: TestGroup = TestGroup("explicitNullsPos")
264209
aggregateTests(
265210
compileFilesInDir("tests/explicit-nulls/pos", explicitNullsOptions),
266-
compileFilesInDir("tests/explicit-nulls/pos-separate", explicitNullsOptions),
267-
compileFilesInDir("tests/explicit-nulls/pos-patmat", explicitNullsOptions and "-Xfatal-warnings"),
268211
compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions and "-language:unsafeNulls"),
269-
compileFile("tests/explicit-nulls/pos-special/i14682.scala", explicitNullsOptions and "-Ysafe-init"),
270-
compileFile("tests/explicit-nulls/pos-special/i14947.scala", explicitNullsOptions and "-Ytest-pickler" and "-Xprint-types"),
271212
)
272213
}.checkCompile()
273214

tests/explicit-nulls/neg-patmat/match-pat.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Xfatal-warnings
2+
13
class Foo {
24

35
val s: String = ???

tests/explicit-nulls/pos-special/i14682.scala renamed to tests/explicit-nulls/pos/i14682.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Ysafe-init
2+
13
class C1:
24
sealed abstract class Name {
35
type ThisName <: Name

tests/explicit-nulls/pos-special/i14947.scala renamed to tests/explicit-nulls/pos/i14947.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Ytest-pickler -Xprint-types
2+
13
class B:
24
def g: String | Null = ???
35

tests/explicit-nulls/pos-patmat/match-pat.scala renamed to tests/explicit-nulls/pos/match-pat.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Xfatal-warnings
2+
13
// Ensure we don't get "the type test for argType cannot be checked at runtime" warning
24

35
class Symbol {

tests/explicit-nulls/pos-patmat/unsafe-match-null-pat.scala renamed to tests/explicit-nulls/pos/unsafe-match-null-pat.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Xfatal-warnings
2+
13
import scala.language.unsafeNulls
24

35
def test1 =

tests/neg-custom-args/deprecation/i11022.check

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/neg-custom-args/erased/erased-case-class.scala

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/neg-custom-args/erased/erased-object.scala

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/neg-custom-args/erased/erased-type.scala

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/neg-custom-args/erased/erased-var.scala

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/neg-custom-args/erased/i6795.check

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/neg-custom-args/fatal-warnings/i11333.check

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/neg-custom-args/fatal-warnings/i11963a.scala

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/neg-custom-args/fatal-warnings/i13440.check

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/neg-custom-args/fatal-warnings/i16728.check

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/neg-custom-args/fatal-warnings/i4936.scala

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/neg-custom-args/fatal-warnings/i6190b.check

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/neg-custom-args/fatal-warnings/i8711.check

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/neg-custom-args/fatal-warnings/symbolic-packages.check

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/neg-custom-args/feature/i13946/BadPrinter.scala

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/neg-custom-args/i10994.scala

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/neg-custom-args/nowarn/nowarn-typer-error.check

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/neg-custom-args/wildcards.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -source future -deprecation -Xfatal-warnings
2+
13
object Test {
24
val xs: List[_] = List(1, 2, 3) // error
35
val ys: Map[_ <: AnyRef, _ >: Null] = Map() // error // error

tests/neg-custom-args/no-experimental/14034.scala renamed to tests/neg/14034.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Yno-experimental
2+
13
import annotation.experimental
24

35
@experimental trait Exp

tests/neg-custom-args/deprecation/14034b.scala renamed to tests/neg/14034b.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// scalac: -Xfatal-warnings -deprecation
12

23
@deprecated trait Exp
34
@deprecated val exp = 1

tests/neg-custom-args/fatal-warnings/IsInstanceOfClassTag.scala renamed to tests/neg/IsInstanceOfClassTag.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Xfatal-warnings
2+
13
import scala.reflect.ClassTag
24

35
object IsInstanceOfClassTag {

tests/neg-custom-args/fatal-warnings/IsInstanceOfClassTag2.scala renamed to tests/neg/IsInstanceOfClassTag2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Xfatal-warnings
2+
13
import scala.reflect.TypeTest
24

35
object IsInstanceOfClassTag {

tests/neg-custom-args/adhoc-extension/B.scala renamed to tests/neg/adhoc-extension/B.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -source future -feature -Xfatal-warnings
2+
13
package adhoc
24
class B extends A // error: adhoc-extension (under -strict -feature -Xfatal-warnings)
35
class C extends A // error

tests/neg-custom-args/autoTuplingTest.scala renamed to tests/neg/autoTuplingTestb.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -language:noAutoTupling
2+
13
object autoTupling {
24

35
val x = Some(1, 2) // error when running with -language:noAutoTupling

tests/neg-custom-args/avoid-warn-deprecation.scala renamed to tests/neg/avoid-warn-deprecation.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Xfatal-warnings -feature
2+
13
object A {
24
@deprecated("use bar instead of this one", "0.2.3")
35
def foo: Int = 3

tests/neg-custom-args/erased/by-name.scala renamed to tests/neg/by-name.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -language:experimental.erasedDefinitions
2+
13
def f(x: => Int, erased y: => Int) = x // error
24
def g(erased x: => Int, y: => Int) = y // error
35

tests/neg-custom-args/capt-wf.scala renamed to tests/neg/capt-wf.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -language:experimental.captureChecking -Xfatal-warnings
2+
13
class C
24
type Cap = C^
35

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// scalac: -Xfatal-warnings
2+
13
import scala.language.`future-migration`
24
import scala.reflect.ClassTag
35

0 commit comments

Comments
 (0)