Skip to content

Commit fd7955f

Browse files
authored
Move separation checking to -source:3.8 (#23249)
Raise separation checking guard to `-source:3.8`. Compilation tests with capture checking are run with this option, as well as `scala2-library-cc`.
1 parent 4dc7db7 commit fd7955f

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

compiler/src/dotty/tools/dotc/cc/ccConfig.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ object ccConfig:
4848

4949
/** If true, turn on separation checking */
5050
def useSepChecks(using Context): Boolean =
51-
Feature.sourceVersion.stable.isAtLeast(SourceVersion.`3.7`)
51+
Feature.sourceVersion.stable.isAtLeast(SourceVersion.`3.8`)
5252

5353
/** If true, do level checking for FreshCap instances */
5454
def useFreshLevels(using Context): Boolean =
@@ -58,4 +58,4 @@ object ccConfig:
5858
def newScheme(using Context): Boolean =
5959
Feature.sourceVersion.stable.isAtLeast(SourceVersion.`3.7`)
6060

61-
end ccConfig
61+
end ccConfig

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CompilationTests {
3737
compileFilesInDir("tests/pos-special/sourcepath/outer", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
3838
compileFile("tests/pos-special/sourcepath/outer/nested/Test4.scala", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
3939
compileFilesInDir("tests/pos-scala2", defaultOptions.and("-source", "3.0-migration")),
40-
compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
40+
compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking", "-source", "3.8")),
4141
compileFile("tests/pos-special/utf8encoded.scala", defaultOptions.and("-encoding", "UTF8")),
4242
compileFile("tests/pos-special/utf16encoded.scala", defaultOptions.and("-encoding", "UTF16")),
4343
compileDir("tests/pos-special/i18589", defaultOptions.and("-Wsafe-init").without("-Ycheck:all")),
@@ -146,7 +146,7 @@ class CompilationTests {
146146
aggregateTests(
147147
compileFilesInDir("tests/neg", defaultOptions, FileFilter.exclude(TestSources.negScala2LibraryTastyExcludelisted)),
148148
compileFilesInDir("tests/neg-deep-subtype", allowDeepSubtypes),
149-
compileFilesInDir("tests/neg-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
149+
compileFilesInDir("tests/neg-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking", "-source", "3.8")),
150150
compileFile("tests/neg-custom-args/sourcepath/outer/nested/Test1.scala", defaultOptions.and("-sourcepath", "tests/neg-custom-args/sourcepath")),
151151
compileDir("tests/neg-custom-args/sourcepath2/hi", defaultOptions.and("-sourcepath", "tests/neg-custom-args/sourcepath2", "-Xfatal-warnings")),
152152
compileList("duplicate source", List(
@@ -169,7 +169,7 @@ class CompilationTests {
169169
aggregateTests(
170170
compileFilesInDir("tests/run", defaultOptions.and("-Wsafe-init")),
171171
compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes),
172-
compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking")),
172+
compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking", "-source", "3.8")),
173173
// Run tests for legacy lazy vals.
174174
compileFilesInDir("tests/run", defaultOptions.and("-Wsafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.runLazyValsAllowlist)),
175175
).checkRuns()

project/Build.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,10 @@ object Build {
12361236
withCommonSettings(Bootstrapped).
12371237
dependsOn(dottyCompiler(Bootstrapped) % "provided; compile->runtime; test->test").
12381238
settings(scala2LibraryBootstrappedSettings).
1239-
settings(moduleName := "scala2-library-cc")
1239+
settings(
1240+
moduleName := "scala2-library-cc",
1241+
scalacOptions ++= Seq("-source", "3.8"), // for separation checking
1242+
)
12401243

12411244
lazy val scala2LibraryBootstrappedSettings = Seq(
12421245
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,

0 commit comments

Comments
 (0)