Skip to content

Commit 6765245

Browse files
committed
Rename -Ycheck-init to -Ysafe-init
to avoid confusion with -Xcheckinit
1 parent 95fa9cb commit 6765245

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ final case class SbtCommunityProject(
130130
object SbtCommunityProject:
131131
def scalacOptions = List(
132132
"-Xcheck-macros",
133-
"-Ycheck-init",
133+
"-Ysafe-init",
134134
)
135135

136136
object projects:
@@ -319,7 +319,7 @@ object projects:
319319
project = "shapeless",
320320
sbtTestCommand = "test",
321321
sbtDocCommand = forceDoc("typeable", "deriving", "data"),
322-
scalacOptions = Nil // disable -Ycheck-init, due to -Xfatal-warnings
322+
scalacOptions = Nil // disable -Ysafe-init, due to -Xfatal-warnings
323323
)
324324

325325
lazy val xmlInterpolator = SbtCommunityProject(
@@ -480,7 +480,7 @@ object projects:
480480
sbtTestCommand = "test",
481481
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal",
482482
dependencies = List(discipline),
483-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ycheck-init")
483+
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init")
484484
)
485485

486486
lazy val simulacrumScalafixAnnotations = SbtCommunityProject(
@@ -494,7 +494,7 @@ object projects:
494494
sbtTestCommand = "set scalaJSStage in Global := FastOptStage;buildJVM;validateAllJS",
495495
sbtPublishCommand = "catsJVM/publishLocal;catsJS/publishLocal",
496496
dependencies = List(discipline, disciplineMunit, scalacheck, simulacrumScalafixAnnotations),
497-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ycheck-init") // disable -Ycheck-init, due to -Xfatal-warning
497+
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init") // disable -Ysafe-init, due to -Xfatal-warning
498498

499499
)
500500

@@ -611,7 +611,7 @@ object projects:
611611
sbtTestCommand = "test",
612612
sbtPublishCommand = "publishLocal",
613613
dependencies = List(), // TODO add scalatest and pprint (see protoquill/build.sbt)
614-
scalacOptions = List("-language:implicitConversions"), // disabled -Ycheck-init, due to bug in macro
614+
scalacOptions = List("-language:implicitConversions"), // disabled -Ysafe-init, due to bug in macro
615615
)
616616

617617
lazy val onnxScala = SbtCommunityProject(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings {
226226
val YnoKindPolymorphism: Setting[Boolean] = BooleanSetting("-Yno-kind-polymorphism", "Disable kind polymorphism.")
227227
val YexplicitNulls: Setting[Boolean] = BooleanSetting("-Yexplicit-nulls", "Make reference types non-nullable. Nullable types can be expressed with unions: e.g. String|Null.")
228228
val YerasedTerms: Setting[Boolean] = BooleanSetting("-Yerased-terms", "Allows the use of erased terms.")
229-
val YcheckInit: Setting[Boolean] = BooleanSetting("-Ycheck-init", "Check initialization of objects")
229+
val YcheckInit: Setting[Boolean] = BooleanSetting("-Ysafe-init", "Ensure safe initialization of objects")
230230
val YrequireTargetName: Setting[Boolean] = BooleanSetting("-Yrequire-targetName", "Warn if an operator is defined without a @targetName annotation")
231231

232232
/** Area-specific debug output */

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CompilationTests {
4040
compileFilesInDir("tests/new", defaultOptions),
4141
compileFilesInDir("tests/pos-scala2", scala2CompatMode),
4242
compileFilesInDir("tests/pos-custom-args/erased", defaultOptions.and("-Yerased-terms")),
43-
compileFilesInDir("tests/pos", defaultOptions.and("-Ycheck-init")),
43+
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")),
4444
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),
4545
compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")),
4646
compileFile(
@@ -190,7 +190,7 @@ class CompilationTests {
190190
compileFile("tests/run-custom-args/defaults-serizaliable-no-forwarders.scala", defaultOptions and "-Xmixin-force-forwarders:false"),
191191
compileFilesInDir("tests/run-custom-args/erased", defaultOptions.and("-Yerased-terms")),
192192
compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes),
193-
compileFilesInDir("tests/run", defaultOptions.and("-Ycheck-init"))
193+
compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init"))
194194
).checkRuns()
195195
}
196196

@@ -315,7 +315,7 @@ class CompilationTests {
315315
// initialization tests
316316
@Test def checkInit: Unit = {
317317
implicit val testGroup: TestGroup = TestGroup("checkInit")
318-
val options = defaultOptions.and("-Ycheck-init", "-Xfatal-warnings")
318+
val options = defaultOptions.and("-Ysafe-init", "-Xfatal-warnings")
319319
compileFilesInDir("tests/init/neg", options).checkExpectedErrors()
320320
compileFilesInDir("tests/init/pos", options).checkCompile()
321321
compileFilesInDir("tests/init/crash", options.without("-Xfatal-warnings")).checkCompile()

docs/blog/_posts/2020-03-18-23rd-dotty-milestone-release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RemoteFile(url: String) extends AbstractFile {
4040
Above, `extension` value is initialized prior to `localFile` because the fields of the parents of a class are initialized prior to the fields of the class. However, `extension` uses `localFile` during its initialization since it accesses this field from the `name` method. This scenario will lead to a `NullPointerException` on runtime when the access to uninitialized `localFile` happens.
4141

4242

43-
In this release, we have added an aid for the programmer to detect such mistakes automatically. If you compile the above program with the `-Ycheck-init` flag, you will get the following compile-time error:
43+
In this release, we have added an aid for the programmer to detect such mistakes automatically. If you compile the above program with the `-Ysafe-init` flag, you will get the following compile-time error:
4444

4545
```scala
4646
-- Error: /Users/kmetiuk/Projects/scala3/pg/release/snip_4.scala:8:7 -----------

docs/docs/reference/other-new-features/explicit-nulls.md

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

50-
The unsoundness above can be caught by the compiler with the option `-Ycheck-init`.
50+
The unsoundness above can be caught by the compiler with the option `-Ysafe-init`.
5151
More details can be found in [safe initialization](./safe-initialization.md).
5252

5353
## Equality

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: doc-page
33
title: "Safe Initialization"
44
---
55

6-
Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Ycheck-init`.
6+
Scala 3 implements experimental safe initialization check, which can be enabled by the compiler option `-Ysafe-init`.
77

88
## A Quick Glance
99

0 commit comments

Comments
 (0)