Skip to content

Commit daeee35

Browse files
committed
Use //> using directive in compilation tests
* Set options with `//> using` * Put together tests that need deep subtypes * -Ycheck tests/run/typeclass-derivation1.scala
1 parent 38350ec commit daeee35

File tree

146 files changed

+241
-70
lines changed

Some content is hidden

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

146 files changed

+241
-70
lines changed

compiler/test/dotc/pos-test-pickling.blacklist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ t5031_2.scala
2323
i16997.scala
2424
i7414.scala
2525
i17588.scala
26+
i9804.scala
27+
i13433.scala
28+
i16649-irrefutable.scala
29+
strict-pattern-bindings-3.0-migration.scala
2630

2731
# Tree is huge and blows stack for printing Text
2832
i7034.scala

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

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,16 @@ class CompilationTests {
3030
@Test def pos: Unit = {
3131
implicit val testGroup: TestGroup = TestGroup("compilePos")
3232
var tests = List(
33-
compileFile("tests/pos/nullarify.scala", defaultOptions.and("-Ycheck:nullarify")),
34-
compileFile("tests/pos-special/utf8encoded.scala", explicitUTF8),
35-
compileFile("tests/pos-special/utf16encoded.scala", explicitUTF16),
33+
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")),
34+
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),
3635
compileFilesInDir("tests/pos-special/sourcepath/outer", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
3736
compileFile("tests/pos-special/sourcepath/outer/nested/Test4.scala", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
38-
compileFilesInDir("tests/pos-special/fatal-warnings", defaultOptions.and("-Xfatal-warnings", "-deprecation", "-feature")),
39-
compileFilesInDir("tests/pos-special/spec-t5545", defaultOptions),
40-
compileFilesInDir("tests/pos-special/strawman-collections", allowDeepSubtypes),
41-
compileFilesInDir("tests/pos-special/isInstanceOf", allowDeepSubtypes.and("-Xfatal-warnings")),
42-
compileFilesInDir("tests/new", defaultOptions.and("-source", "3.2")), // just to see whether 3.2 works
43-
compileFilesInDir("tests/pos-scala2", scala2CompatMode),
37+
compileFilesInDir("tests/pos-scala2", defaultOptions.and("-source", "3.0-migration")),
4438
compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
45-
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")),
39+
compileFile("tests/pos-special/utf8encoded.scala", defaultOptions.and("-encoding", "UTF8")),
40+
compileFile("tests/pos-special/utf16encoded.scala", defaultOptions.and("-encoding", "UTF16")),
4641
// Run tests for legacy lazy vals
4742
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)),
48-
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),
4943
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
5044
compileDir("tests/pos-special/stdlib", defaultOptions),
5145
)
@@ -60,7 +54,7 @@ class CompilationTests {
6054
implicit val testGroup: TestGroup = TestGroup("rewrites")
6155

6256
aggregateTests(
63-
compileFile("tests/rewrites/rewrites.scala", scala2CompatMode.and("-rewrite", "-indent")),
57+
compileFile("tests/rewrites/rewrites.scala", defaultOptions.and("-source", "3.0-migration").and("-rewrite", "-indent")),
6458
compileFile("tests/rewrites/rewrites3x.scala", defaultOptions.and("-rewrite", "-source", "future-migration")),
6559
compileFile("tests/rewrites/rewrites3x-fatal-warnings.scala", defaultOptions.and("-rewrite", "-source", "future-migration", "-Xfatal-warnings")),
6660
compileFile("tests/rewrites/filtering-fors.scala", defaultOptions.and("-rewrite", "-source", "3.2-migration")),
@@ -121,27 +115,14 @@ class CompilationTests {
121115
implicit val testGroup: TestGroup = TestGroup("compileNeg")
122116
aggregateTests(
123117
compileFilesInDir("tests/neg", defaultOptions),
124-
compileFilesInDir("tests/neg-tailcall", defaultOptions),
125-
compileFilesInDir("tests/neg-strict", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
126-
compileFilesInDir("tests/neg-custom-args/allow-double-bindings", allowDoubleBindings),
127-
compileFilesInDir("tests/neg-custom-args/allow-deep-subtypes", allowDeepSubtypes),
118+
compileFilesInDir("tests/neg-deep-subtype", allowDeepSubtypes),
128119
compileFilesInDir("tests/neg-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
129-
compileFile("tests/neg-custom-args/i1650.scala", allowDeepSubtypes),
130-
compileFile("tests/neg-custom-args/i3882.scala", allowDeepSubtypes),
131-
compileFile("tests/neg-custom-args/i4372.scala", allowDeepSubtypes),
132-
compileFile("tests/neg-custom-args/i1754.scala", allowDeepSubtypes),
133-
compileFile("tests/neg-custom-args/i12650.scala", allowDeepSubtypes),
134-
compileFile("tests/neg-custom-args/interop-polytypes.scala", allowDeepSubtypes.and("-Yexplicit-nulls")),
135-
compileFile("tests/neg-custom-args/conditionalWarnings.scala", allowDeepSubtypes.and("-deprecation").and("-Xfatal-warnings")),
136-
compileFilesInDir("tests/neg-custom-args/isInstanceOf", allowDeepSubtypes and "-Xfatal-warnings"),
137-
compileFile("tests/neg-custom-args/i3627.scala", allowDeepSubtypes),
138120
compileFile("tests/neg-custom-args/sourcepath/outer/nested/Test1.scala", defaultOptions.and("-sourcepath", "tests/neg-custom-args/sourcepath")),
139121
compileDir("tests/neg-custom-args/sourcepath2/hi", defaultOptions.and("-sourcepath", "tests/neg-custom-args/sourcepath2", "-Xfatal-warnings")),
140122
compileList("duplicate source", List(
141123
"tests/neg-custom-args/toplevel-samesource/S.scala",
142124
"tests/neg-custom-args/toplevel-samesource/nested/S.scala"),
143125
defaultOptions),
144-
compileFile("tests/neg-custom-args/i6300.scala", allowDeepSubtypes),
145126
compileFile("tests/neg/i7575.scala", defaultOptions.withoutLanguageFeatures.and("-language:_")),
146127
).checkExpectedErrors()
147128
}
@@ -156,12 +137,9 @@ class CompilationTests {
156137
@Test def runAll: Unit = {
157138
implicit val testGroup: TestGroup = TestGroup("runAll")
158139
aggregateTests(
159-
compileFile("tests/run-custom-args/typeclass-derivation1.scala", defaultOptions.without(yCheckOptions*)),
160-
compileFile("tests/run-custom-args/tuple-cons.scala", allowDeepSubtypes),
161-
compileFile("tests/run-custom-args/i5256.scala", allowDeepSubtypes),
162-
compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking")),
163-
compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes),
164140
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init")),
141+
compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes),
142+
compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking")),
165143
// Run tests for legacy lazy vals.
166144
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.runLazyValsAllowlist)),
167145
).checkRuns()
@@ -179,7 +157,6 @@ class CompilationTests {
179157
@Test def pickling: Unit = {
180158
implicit val testGroup: TestGroup = TestGroup("testPickling")
181159
aggregateTests(
182-
compileFilesInDir("tests/new", picklingOptions),
183160
compileFilesInDir("tests/pos", picklingOptions, FileFilter.exclude(TestSources.posTestPicklingBlacklisted)),
184161
compileFilesInDir("tests/run", picklingOptions, FileFilter.exclude(TestSources.runTestPicklingBlacklisted))
185162
).checkCompile()
@@ -189,8 +166,7 @@ class CompilationTests {
189166
def recheck: Unit =
190167
given TestGroup = TestGroup("recheck")
191168
aggregateTests(
192-
compileFilesInDir("tests/new", recheckOptions),
193-
compileFilesInDir("tests/run", recheckOptions, FileFilter.exclude(TestSources.runTestRecheckExcluded))
169+
compileFilesInDir("tests/run", defaultOptions.and("-Yrecheck-test"), FileFilter.exclude(TestSources.runTestRecheckExcluded))
194170
//Disabled to save some time.
195171
//compileFilesInDir("tests/pos", recheckOptions, FileFilter.exclude(TestSources.posTestRecheckExcluded)),
196172
).checkCompile()
@@ -199,22 +175,22 @@ class CompilationTests {
199175
@Test def explicitNullsNeg: Unit = {
200176
implicit val testGroup: TestGroup = TestGroup("explicitNullsNeg")
201177
aggregateTests(
202-
compileFilesInDir("tests/explicit-nulls/neg", explicitNullsOptions),
203-
compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions),
178+
compileFilesInDir("tests/explicit-nulls/neg", defaultOptions and "-Yexplicit-nulls"),
179+
compileFilesInDir("tests/explicit-nulls/unsafe-common", defaultOptions and "-Yexplicit-nulls"),
204180
)
205181
}.checkExpectedErrors()
206182

207183
@Test def explicitNullsPos: Unit = {
208184
implicit val testGroup: TestGroup = TestGroup("explicitNullsPos")
209185
aggregateTests(
210-
compileFilesInDir("tests/explicit-nulls/pos", explicitNullsOptions),
211-
compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions and "-language:unsafeNulls"),
186+
compileFilesInDir("tests/explicit-nulls/pos", defaultOptions and "-Yexplicit-nulls"),
187+
compileFilesInDir("tests/explicit-nulls/unsafe-common", defaultOptions and "-Yexplicit-nulls" and "-language:unsafeNulls"),
212188
)
213189
}.checkCompile()
214190

215191
@Test def explicitNullsRun: Unit = {
216192
implicit val testGroup: TestGroup = TestGroup("explicitNullsRun")
217-
compileFilesInDir("tests/explicit-nulls/run", explicitNullsOptions)
193+
compileFilesInDir("tests/explicit-nulls/run", defaultOptions and "-Yexplicit-nulls")
218194
}.checkRuns()
219195

220196
// initialization tests

compiler/test/dotty/tools/vulpix/TestConfiguration.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,6 @@ object TestConfiguration {
8484
)
8585
val picklingWithCompilerOptions =
8686
picklingOptions.withClasspath(withCompilerClasspath).withRunClasspath(withCompilerClasspath)
87-
val recheckOptions = defaultOptions.and("-Yrecheck-test")
88-
val scala2CompatMode = defaultOptions.and("-source", "3.0-migration")
89-
val explicitUTF8 = defaultOptions and ("-encoding", "UTF8")
90-
val explicitUTF16 = defaultOptions and ("-encoding", "UTF16")
91-
92-
/** Enables explicit nulls */
93-
val explicitNullsOptions = defaultOptions and "-Yexplicit-nulls"
9487

9588
/** Default target of the generated class files */
9689
private def defaultTarget: String = {

tests/neg-custom-args/isInstanceOf/1828.scala renamed to tests/neg-deep-subtype/1828.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//> using options -Xfatal-warnings
2+
13
class Test {
24
def remove[S](a: S | Int, f: Int => S):S = a match {
35
case a: S => a // error

tests/neg-custom-args/isInstanceOf/3324b.scala renamed to tests/neg-deep-subtype/3324b.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//> using options -Xfatal-warnings
2+
13
class C[T] {
24
val x: Any = ???
35
if (x.isInstanceOf[List[String]]) // error: unchecked

tests/neg-custom-args/isInstanceOf/3324f.scala renamed to tests/neg-deep-subtype/3324f.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//> using options -Xfatal-warnings
2+
13
trait C[T]
24
class D[T]
35

tests/neg-custom-args/isInstanceOf/3324g.scala renamed to tests/neg-deep-subtype/3324g.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//> using options -Xfatal-warnings
2+
13
class Test {
24
trait A[+T]
35
class B[T] extends A[T]

tests/neg-custom-args/isInstanceOf/4075.scala.ignore renamed to tests/neg-deep-subtype/4075.scala.ignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//> using options -Xfatal-warnings
2+
13
object Test {
24
trait Foo
35
case class One[+T](fst: T)

tests/neg-custom-args/isInstanceOf/JavaSeqLiteral.scala renamed to tests/neg-deep-subtype/JavaSeqLiteral.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//> using options -Xfatal-warnings
2+
13
object Test1 {
24
trait Tree[-T]
35

tests/neg-custom-args/conditionalWarnings.scala renamed to tests/neg-deep-subtype/conditionalWarnings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
//> using options -deprecation -Xfatal-warnings
12

2-
// run with -deprecation -Xfatal-warnings
33
object Test {
44
@deprecated def foo = ???
55

0 commit comments

Comments
 (0)