Skip to content

Commit ee74631

Browse files
committed
Lift -Ysafe-init to -Wsafe-init
1 parent d00c7e9 commit ee74631

File tree

13 files changed

+51
-33
lines changed

13 files changed

+51
-33
lines changed

Test.scala

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

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ final case class SbtCommunityProject(
149149
object SbtCommunityProject:
150150
def scalacOptions = List(
151151
"-Xcheck-macros",
152-
"-Ysafe-init",
152+
"-Wsafe-init",
153153
)
154154

155155
object projects:
@@ -362,7 +362,7 @@ object projects:
362362
project = "shapeless-3",
363363
sbtTestCommand = "testJVM; testJS",
364364
sbtDocCommand = forceDoc("typeable", "deriving"),
365-
scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"), // due to -Xfatal-warnings
365+
scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(!List("-Ysafe-init", "-Wsafe-init").contains), // due to -Xfatal-warnings
366366
)
367367

368368
lazy val xmlInterpolator = SbtCommunityProject(
@@ -429,7 +429,7 @@ object projects:
429429
sbtTestCommand = "unitTests/test",
430430
// Adds <empty> package
431431
sbtDocCommand = "coreJVM/doc",
432-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"),
432+
scalacOptions = SbtCommunityProject.scalacOptions.filter(!List("-Ysafe-init", "-Wsafe-init").contains),
433433
dependencies = List(munit, scodecBits),
434434
)
435435

@@ -510,7 +510,7 @@ object projects:
510510
project = "discipline",
511511
sbtTestCommand = "coreJVM/test;coreJS/test",
512512
sbtPublishCommand = "set every credentials := Nil;coreJVM/publishLocal;coreJS/publishLocal",
513-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"),
513+
scalacOptions = SbtCommunityProject.scalacOptions.filter(!List("-Ysafe-init", "-Wsafe-init").contains),
514514
dependencies = List(scalacheck)
515515
)
516516

@@ -526,7 +526,7 @@ object projects:
526526
sbtTestCommand = "test",
527527
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal",
528528
dependencies = List(discipline),
529-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init")
529+
scalacOptions = SbtCommunityProject.scalacOptions.filter(!List("-Ysafe-init", "-Wsafe-init").contains)
530530
)
531531

532532
lazy val simulacrumScalafixAnnotations = SbtCommunityProject(
@@ -540,7 +540,7 @@ object projects:
540540
sbtTestCommand = "set Global/scalaJSStage := FastOptStage;rootJVM/test;rootJS/test",
541541
sbtPublishCommand = "rootJVM/publishLocal;rootJS/publishLocal",
542542
dependencies = List(discipline, disciplineMunit, scalacheck, simulacrumScalafixAnnotations),
543-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init") // disable -Ysafe-init, due to -Xfatal-warning
543+
scalacOptions = SbtCommunityProject.scalacOptions.filter(!List("-Ysafe-init", "-Wsafe-init").contains) // disable -Ysafe-init or -Wsafe-init, due to -Xfatal-warning
544544

545545
)
546546

@@ -656,7 +656,7 @@ object projects:
656656
"""set actorTests/Compile/scalacOptions -= "-Xfatal-warnings"""",
657657
"akka-actor-tests/Test/compile",
658658
).mkString("; "),
659-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"),
659+
scalacOptions = SbtCommunityProject.scalacOptions.filter(!List("-Ysafe-init", "-Wsafe-init").contains),
660660
dependencies = List(scalatest, scalatestplusJunit, scalatestplusScalacheck)
661661
)
662662

@@ -707,7 +707,7 @@ object projects:
707707
project = "fs2",
708708
sbtTestCommand = "coreJVM/test; coreJS/test", // io/test requires JDK9+
709709
sbtPublishCommand = "coreJVM/publishLocal; coreJS/publishLocal",
710-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"),
710+
scalacOptions = SbtCommunityProject.scalacOptions.filter(!List("-Ysafe-init", "-Wsafe-init").contains),
711711
dependencies = List(cats, catsEffect3, munitCatsEffect, scalacheckEffect, scodecBits)
712712
)
713713

@@ -744,7 +744,7 @@ object projects:
744744
project = "http4s",
745745
sbtTestCommand = """set ThisBuild / tlFatalWarnings := false; rootJVM/test""",
746746
sbtPublishCommand = "publishLocal",
747-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"),
747+
scalacOptions = SbtCommunityProject.scalacOptions.filter(!List("-Ysafe-init", "-Wsafe-init").contains),
748748
dependencies = List(cats, catsEffect3, fs2, disciplineMunit, scalacheckEffect)
749749
)
750750

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ private sealed trait WarningSettings:
292292
def typeParameterShadow(using Context) =
293293
allOr("type-parameter-shadow")
294294

295+
val WcheckInit: Setting[Boolean] = BooleanSetting(WarningSetting, "Wsafe-init", "Ensure safe initialization of objects.")
295296

296297
/** -X "Extended" or "Advanced" settings */
297298
private sealed trait XSettings:
@@ -323,12 +324,18 @@ private sealed trait XSettings:
323324
val Xdumpclasses: Setting[String] = StringSetting(AdvancedSetting, "Xdump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "")
324325
val XjarCompressionLevel: Setting[Int] = IntChoiceSetting(AdvancedSetting, "Xjar-compression-level", "compression level to use when writing jar files", Deflater.DEFAULT_COMPRESSION to Deflater.BEST_COMPRESSION, Deflater.DEFAULT_COMPRESSION)
325326
val XkindProjector: Setting[String] = ChoiceSetting(AdvancedSetting, "Xkind-projector", "[underscores, enable, disable]", "Allow `*` as type lambda placeholder to be compatible with kind projector. When invoked as -Xkind-projector:underscores will repurpose `_` to be a type parameter placeholder, this will disable usage of underscore as a wildcard.", List("disable", "", "underscores"), "disable", legacyArgs = true)
327+
328+
/** Documentation related settings */
326329
val XdropComments: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xdrop-docs", "Drop documentation when scanning source files.", aliases = List("-Xdrop-comments"))
327330
val XcookComments: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xcook-docs", "Cook the documentation (type check `@usecase`, etc.)", aliases = List("-Xcook-comments"))
328331
val XreadComments: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xread-docs", "Read documentation from tasty.")
332+
333+
/** Area-specific debug output */
329334
val XnoDecodeStacktraces: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.")
330335
val XnoEnrichErrorMessages: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xno-enrich-error-messages", "Show raw error messages, instead of enriching them with contextual information.")
331336
val XdebugMacros: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xdebug-macros", "Show debug info when quote pattern match fails")
337+
338+
/** Pipeline compilation options */
332339
val XjavaTasty: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xjava-tasty", "Pickler phase should compute TASTy for .java defined symbols for use by build tools", aliases = List("-Xpickle-java"), preferPrevious = true)
333340
val XearlyTastyOutput: Setting[AbstractFile] = OutputSetting(AdvancedSetting, "Xearly-tasty-output", "directory|jar", "Destination to write generated .tasty files to for use in pipelined compilation.", NoAbstractFile, aliases = List("-Xpickle-write"), preferPrevious = true)
334341
val XallowOutlineFromTasty: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xallow-outline-from-tasty", "Allow outline TASTy to be loaded with the -from-tasty option.")
@@ -440,7 +447,6 @@ private sealed trait YSettings:
440447
val YnoKindPolymorphism: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-kind-polymorphism", "Disable kind polymorphism.")
441448
val YexplicitNulls: Setting[Boolean] = BooleanSetting(ForkSetting, "Yexplicit-nulls", "Make reference types non-nullable. Nullable types can be expressed with unions: e.g. String|Null.")
442449
val YnoFlexibleTypes: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-flexible-types", "Disable turning nullable Java return types and parameter types into flexible types, which behave like abstract types with a nullable lower bound and non-nullable upper bound.")
443-
val YcheckInit: Setting[Boolean] = BooleanSetting(ForkSetting, "Ysafe-init", "Ensure safe initialization of objects.")
444450
val YcheckInitGlobal: Setting[Boolean] = BooleanSetting(ForkSetting, "Ysafe-init-global", "Check safe initialization of global objects.")
445451
val YrequireTargetName: Setting[Boolean] = BooleanSetting(ForkSetting, "Yrequire-targetName", "Warn if an operator is defined without a @targetName annotation.")
446452
val YrecheckTest: Setting[Boolean] = BooleanSetting(ForkSetting, "Yrecheck-test", "Run basic rechecking (internal test only).")
@@ -472,4 +478,7 @@ private sealed trait YSettings:
472478
val YjavaTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Yjava-tasty", "Pickler phase should compute TASTy for .java defined symbols for use by build tools", aliases = List("-Ypickle-java"), preferPrevious = true, deprecation = Some(Deprecation("Use -Xjava-tasty instead.", "-Xjava-tasty")))
473479
val YearlyTastyOutput: Setting[AbstractFile] = OutputSetting(ForkSetting, "Yearly-tasty-output", "directory|jar", "Destination to write generated .tasty files to for use in pipelined compilation.", NoAbstractFile, aliases = List("-Ypickle-write"), preferPrevious = true, deprecation = Some(Deprecation("Use -Xearly-tasty-output instead.", "-Xearly-tasty-output")))
474480
val YallowOutlineFromTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Yallow-outline-from-tasty", "Allow outline TASTy to be loaded with the -from-tasty option.", deprecation = Some(Deprecation("Use -Xallow-outline-from-tasty instead.", "-Xallow-outline-from-tasty")))
481+
482+
// Deprecated: lifted from -Y to -W
483+
val YcheckInit: Setting[Boolean] = BooleanSetting(ForkSetting, "Ysafe-init", "Ensure safe initialization of objects.", deprecation = Some(Deprecation("Use -Wsafe-init instead.", "-Wsafe-init")))
475484
end YSettings

compiler/src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ object Symbols extends SymUtils {
8484
ctx.settings.YretainTrees.value ||
8585
denot.owner.isTerm || // no risk of leaking memory after a run for these
8686
denot.isOneOf(InlineOrProxy) || // need to keep inline info
87-
ctx.settings.YcheckInit.value || // initialization check
87+
ctx.settings.WcheckInit.value || // initialization check
8888
ctx.settings.YcheckInitGlobal.value
8989

9090
/** The last denotation of this symbol */

compiler/src/dotty/tools/dotc/transform/init/Checker.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Checker extends Phase:
2929
override val runsAfter = Set(Pickler.name)
3030

3131
override def isEnabled(using Context): Boolean =
32-
super.isEnabled && (ctx.settings.YcheckInit.value || ctx.settings.YcheckInitGlobal.value)
32+
super.isEnabled && (ctx.settings.WcheckInit.value || ctx.settings.YcheckInitGlobal.value)
3333

3434
def traverse(traverser: InitTreeTraverser)(using Context): Boolean = monitor(phaseName):
3535
val unit = ctx.compilationUnit
@@ -50,7 +50,7 @@ class Checker extends Phase:
5050
cancellable {
5151
val classes = traverser.getClasses()
5252

53-
if ctx.settings.YcheckInit.value then
53+
if ctx.settings.WcheckInit.value then
5454
Semantic.checkClasses(classes)(using checkCtx)
5555

5656
if ctx.settings.YcheckInitGlobal.value then

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ class CompilationTests {
3131
@Test def pos: Unit = {
3232
implicit val testGroup: TestGroup = TestGroup("compilePos")
3333
var tests = List(
34-
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Wunused:all", "-Wshadow:private-shadow", "-Wshadow:type-parameter-shadow"), FileFilter.include(TestSources.posLintingAllowlist)),
35-
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init"), FileFilter.exclude(TestSources.posLintingAllowlist)),
34+
compileFilesInDir("tests/pos", defaultOptions.and("-Wsafe-init", "-Wunused:all", "-Wshadow:private-shadow", "-Wshadow:type-parameter-shadow"), FileFilter.include(TestSources.posLintingAllowlist)),
35+
compileFilesInDir("tests/pos", defaultOptions.and("-Wsafe-init"), FileFilter.exclude(TestSources.posLintingAllowlist)),
3636
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),
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")),
4040
compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")),
4141
compileFile("tests/pos-special/utf8encoded.scala", defaultOptions.and("-encoding", "UTF8")),
4242
compileFile("tests/pos-special/utf16encoded.scala", defaultOptions.and("-encoding", "UTF16")),
43-
compileDir("tests/pos-special/i18589", defaultOptions.and("-Ysafe-init").without("-Ycheck:all")),
43+
compileDir("tests/pos-special/i18589", defaultOptions.and("-Wsafe-init").without("-Ycheck:all")),
4444
// Run tests for legacy lazy vals
45-
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)),
45+
compileFilesInDir("tests/pos", defaultOptions.and("-Wsafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)),
4646
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
4747
) ::: (
4848
// TODO create a folder for capture checking tests with the stdlib, or use tests/pos-custom-args/captures under this mode?
@@ -51,7 +51,7 @@ class CompilationTests {
5151
)
5252

5353
if scala.util.Properties.isJavaAtLeast("16") then
54-
tests ::= compileFilesInDir("tests/pos-java16+", defaultOptions.and("-Ysafe-init"))
54+
tests ::= compileFilesInDir("tests/pos-java16+", defaultOptions.and("-Wsafe-init"))
5555

5656
aggregateTests(tests*).checkCompile()
5757
}
@@ -157,11 +157,11 @@ class CompilationTests {
157157
@Test def runAll: Unit = {
158158
implicit val testGroup: TestGroup = TestGroup("runAll")
159159
aggregateTests(
160-
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init")),
160+
compileFilesInDir("tests/run", defaultOptions.and("-Wsafe-init")),
161161
compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes),
162162
compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking")),
163163
// Run tests for legacy lazy vals.
164-
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.runLazyValsAllowlist)),
164+
compileFilesInDir("tests/run", defaultOptions.and("-Wsafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.runLazyValsAllowlist)),
165165
).checkRuns()
166166
}
167167

@@ -225,9 +225,9 @@ class CompilationTests {
225225
// initialization tests
226226
@Test def checkInit: Unit = {
227227
implicit val testGroup: TestGroup = TestGroup("checkInit")
228-
val options = defaultOptions.and("-Ysafe-init", "-Xfatal-warnings")
228+
val options = defaultOptions.and("-Wsafe-init", "-Xfatal-warnings")
229229
compileFilesInDir("tests/init/neg", options).checkExpectedErrors()
230-
compileFilesInDir("tests/init/warn", defaultOptions.and("-Ysafe-init")).checkWarnings()
230+
compileFilesInDir("tests/init/warn", defaultOptions.and("-Wsafe-init")).checkWarnings()
231231
compileFilesInDir("tests/init/pos", options).checkCompile()
232232
compileFilesInDir("tests/init/crash", options.without("-Xfatal-warnings")).checkCompile()
233233
// The regression test for i12128 has some atypical classpath requirements.

compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class ScalaSettingsTests:
103103
createTestCase(settings.YjavaTasty , settings.XjavaTasty),
104104
createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput, ":./"),
105105
createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty),
106+
createTestCase(settings.YcheckInit , settings.WcheckInit),
106107
).map: (deprecatedArgument, newSetting) =>
107108
val args = List(deprecatedArgument)
108109
val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil)
@@ -130,6 +131,7 @@ class ScalaSettingsTests:
130131
createTestCase(settings.YjavaTasty , settings.XjavaTasty),
131132
createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput, ":./"),
132133
createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty),
134+
createTestCase(settings.YcheckInit , settings.WcheckInit),
133135
).flatten.map: (deprecatedArgument, newSetting) =>
134136
val args = List(deprecatedArgument)
135137
val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil)

docs/_docs/reference/experimental/explicit-nulls.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ val c = new C()
8585
// c.f == "field is null"
8686
```
8787

88-
The unsoundness above can be caught by the compiler with the option `-Ysafe-init`.
88+
The unsoundness above can be caught by the compiler with the option `-Wsafe-init`.
8989
More details can be found in [safe initialization](../other-new-features/safe-initialization.md).
9090

9191
## Equality

docs/_docs/reference/other-new-features/safe-initialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: "Safe Initialization"
44
nightlyOf: https://docs.scala-lang.org/scala3/reference/other-new-features/safe-initialization.html
55
---
66

7-
Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Ysafe-init`.
7+
Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Wsafe-init`.
88

99
The design and implementation of the initialization checker is described in the
1010
paper _Safe object initialization, abstractly_ [3].

docs/_spec/TODOreference/other-new-features/safe-initialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: "Safe Initialization"
44
nightlyOf: https://docs.scala-lang.org/scala3/reference/other-new-features/safe-initialization.html
55
---
66

7-
Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Ysafe-init`.
7+
Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Wsafe-init`.
88

99
The design and implementation of the initialization checker is described in the
1010
paper _Safe object initialization, abstractly_ [3].

project/Build.scala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,8 @@ object Build {
602602

603603
// Settings shared between scala3-compiler and scala3-compiler-bootstrapped
604604
lazy val commonDottyCompilerSettings = Seq(
605-
// Note: bench/profiles/projects.yml should be updated accordingly.
606-
Compile / scalacOptions ++= Seq("-Yexplicit-nulls", "-Ysafe-init"),
605+
// Note: bench/profiles/projects.yml should be updated accordingly.
606+
Compile / scalacOptions ++= Seq("-Yexplicit-nulls"),
607607

608608
// Use source 3.3 to avoid fatal migration warnings on scalajs-ir
609609
scalacOptions ++= Seq("-source", "3.3"),
@@ -880,6 +880,8 @@ object Build {
880880
}
881881

882882
lazy val nonBootstrappedDottyCompilerSettings = commonDottyCompilerSettings ++ Seq(
883+
// FIXME revert this to commonDottyCompilerSettings, when we bump reference version to 3.5.0
884+
scalacOptions += "-Ysafe-init",
883885
// packageAll packages all and then returns a map with the abs location
884886
packageAll := Def.taskDyn { // Use a dynamic task to avoid loops when loading the settings
885887
Def.task {
@@ -907,6 +909,8 @@ object Build {
907909
)
908910

909911
lazy val bootstrappedDottyCompilerSettings = commonDottyCompilerSettings ++ Seq(
912+
// FIXME revert this to commonDottyCompilerSettings, when we bump reference version to 3.5.0
913+
scalacOptions += "-Wsafe-init",
910914
javaOptions ++= {
911915
val jars = packageAll.value
912916
Seq(
@@ -1335,7 +1339,7 @@ object Build {
13351339
BuildInfoPlugin.buildInfoScopedSettings(Test) ++
13361340
BuildInfoPlugin.buildInfoDefaultSettings
13371341

1338-
lazy val presentationCompilerSettings = {
1342+
def presentationCompilerSettings(implicit mode: Mode) = {
13391343
val mtagsVersion = "1.2.2+44-42e0515a-SNAPSHOT"
13401344

13411345
Seq(
@@ -1349,7 +1353,11 @@ object Build {
13491353
ivyConfigurations += SourceDeps.hide,
13501354
transitiveClassifiers := Seq("sources"),
13511355
scalacOptions ++= Seq("-source", "3.3"), // To avoid fatal migration warnings
1352-
Compile / scalacOptions ++= Seq("-Yexplicit-nulls", "-Ysafe-init"),
1356+
// FIXME change this to just Seq("-Yexplicit-nulls, "-Wsafe-init") when reference is set to 3.5.0
1357+
Compile / scalacOptions ++= (mode match {
1358+
case Bootstrapped => Seq("-Yexplicit-nulls", "-Wsafe-init")
1359+
case NonBootstrapped => Seq("-Yexplicit-nulls", "-Ysafe-init")
1360+
}),
13531361
Compile / sourceGenerators += Def.task {
13541362
val s = streams.value
13551363
val cacheDir = s.cacheDirectory

0 commit comments

Comments
 (0)