Skip to content

Commit 654ec8e

Browse files
committed
Move explicit nulls tests
1 parent 7a340a0 commit 654ec8e

File tree

8 files changed

+9
-10
lines changed

8 files changed

+9
-10
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class CompilationTests {
5252
),
5353
compileFile("tests/pos-special/typeclass-scaling.scala", defaultOptions.and("-Xmax-inlines", "40")),
5454
compileFile("tests/pos-special/i7296.scala", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
55-
compileFile("tests/pos-special/notNull.scala", defaultOptions.and("-Yexplicit-nulls")),
5655
compileDir("tests/pos-special/adhoc-extension", defaultOptions.and("-source", "future", "-feature", "-Xfatal-warnings")),
5756
compileFile("tests/pos-special/i7575.scala", defaultOptions.andLanguageFeature("dynamics")),
5857
compileFile("tests/pos-special/kind-projector.scala", defaultOptions.and("-Ykind-projector")),
@@ -137,7 +136,6 @@ class CompilationTests {
137136
compileFilesInDir("tests/neg-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")),
138137
compileFilesInDir("tests/neg-custom-args/allow-double-bindings", allowDoubleBindings),
139138
compileFilesInDir("tests/neg-custom-args/allow-deep-subtypes", allowDeepSubtypes),
140-
compileFilesInDir("tests/neg-custom-args/explicit-nulls", defaultOptions.and("-Yexplicit-nulls")),
141139
compileFilesInDir("tests/neg-custom-args/no-experimental", defaultOptions.and("-Yno-experimental")),
142140
compileDir("tests/neg-custom-args/impl-conv", defaultOptions.and("-Xfatal-warnings", "-feature")),
143141
compileDir("tests/neg-custom-args/i13946", defaultOptions.and("-Xfatal-warnings", "-feature")),
@@ -249,6 +247,7 @@ class CompilationTests {
249247
compileFilesInDir("tests/explicit-nulls/pos-separate", explicitNullsOptions),
250248
compileFilesInDir("tests/explicit-nulls/pos-patmat", explicitNullsOptions and "-Xfatal-warnings"),
251249
compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions and "-language:unsafeNulls"),
250+
compileFile("tests/explicit-nulls/pos-special/i14682.scala", explicitNullsOptions and "-Ysafe-init"),
252251
)
253252
}.checkCompile()
254253

tests/neg-custom-args/explicit-nulls/byname-nullables.check renamed to tests/explicit-nulls/neg/byname-nullables.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/explicit-nulls/byname-nullables.scala:19:24 -----------------------
1+
-- [E007] Type Mismatch Error: tests/explicit-nulls/neg/byname-nullables.scala:19:24 -----------------------------------
22
19 | if x != null then f(x) // error: f is call-by-name
33
| ^
44
| Found: (x : String | Null)
55
| Required: String
66
|
77
| longer explanation available when compiling with `-explain`
8-
-- Error: tests/neg-custom-args/explicit-nulls/byname-nullables.scala:43:32 --------------------------------------------
8+
-- Error: tests/explicit-nulls/neg/byname-nullables.scala:43:32 --------------------------------------------------------
99
43 | if x != null then f(identity(x), 1) // error: dropping not null check fails typing
1010
| ^^^^^^^^^^^
1111
| This argument was typed using flow assumptions about mutable variables
1212
| but it is passed to a by-name parameter where such flow assumptions are unsound.
1313
| Wrapping the argument in `byName(...)` fixes the problem by disabling the flow assumptions.
1414
|
1515
| `byName` needs to be imported from the `scala.compiletime` package.
16-
-- Error: tests/neg-custom-args/explicit-nulls/byname-nullables.scala:68:24 --------------------------------------------
16+
-- Error: tests/explicit-nulls/neg/byname-nullables.scala:68:24 --------------------------------------------------------
1717
68 | if x != null then f(x, 1) // error: dropping not null check typechecks OK, but gives incompatible result type
1818
| ^
1919
| This argument was typed using flow assumptions about mutable variables
2020
| but it is passed to a by-name parameter where such flow assumptions are unsound.
2121
| Wrapping the argument in `byName(...)` fixes the problem by disabling the flow assumptions.
2222
|
2323
| `byName` needs to be imported from the `scala.compiletime` package.
24-
-- [E134] Type Error: tests/neg-custom-args/explicit-nulls/byname-nullables.scala:81:22 --------------------------------
24+
-- [E134] Type Error: tests/explicit-nulls/neg/byname-nullables.scala:81:22 --------------------------------------------
2525
81 | if x != null then f(byName(x), 1) // error: none of the overloaded methods match argument types
2626
| ^
2727
| None of the overloaded alternatives of method f in object Test7 with types

tests/neg-custom-args/explicit-nulls/byname-nullables1.check renamed to tests/explicit-nulls/neg/byname-nullables1.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Error: tests/neg-custom-args/explicit-nulls/byname-nullables1.scala:10:6 --------------------------------------------
1+
-- Error: tests/explicit-nulls/neg/byname-nullables1.scala:10:6 --------------------------------------------------------
22
10 | f(x.fld != null) // error
33
| ^^^^^^^^^^^^^
44
| This argument was typed using flow assumptions about mutable variables

tests/neg-custom-args/explicit-nulls/i7883.check renamed to tests/explicit-nulls/neg/i7883.check

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
-- [E134] Type Error: tests/neg-custom-args/explicit-nulls/i7883.scala:6:11 --------------------------------------------
1+
-- [E134] Type Error: tests/explicit-nulls/neg/i7883.scala:6:11 --------------------------------------------------------
22
6 | case r(hd, tl) => Some((hd, tl)) // error // error // error
33
| ^
44
| None of the overloaded alternatives of method unapplySeq in class Regex with types
55
| (m: scala.util.matching.Regex.Match): Option[List[String]]
66
| (c: Char): Option[List[Char]]
77
| (s: CharSequence): Option[List[String]]
88
| match arguments (String | Null)
9-
-- [E006] Not Found Error: tests/neg-custom-args/explicit-nulls/i7883.scala:6:30 ---------------------------------------
9+
-- [E006] Not Found Error: tests/explicit-nulls/neg/i7883.scala:6:30 ---------------------------------------------------
1010
6 | case r(hd, tl) => Some((hd, tl)) // error // error // error
1111
| ^^
1212
| Not found: hd
1313
|
1414
| longer explanation available when compiling with `-explain`
15-
-- [E006] Not Found Error: tests/neg-custom-args/explicit-nulls/i7883.scala:6:34 ---------------------------------------
15+
-- [E006] Not Found Error: tests/explicit-nulls/neg/i7883.scala:6:34 ---------------------------------------------------
1616
6 | case r(hd, tl) => Some((hd, tl)) // error // error // error
1717
| ^^
1818
| Not found: tl

0 commit comments

Comments
 (0)