Skip to content

Commit f372d14

Browse files
committed
Fix compilation
1 parent 1879cb7 commit f372d14

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,15 @@ private sealed trait WarningSettings:
282282
|to prevent the shell from expanding patterns.""".stripMargin,
283283
)
284284

285-
val WcheckInit: Setting[Boolean] = BooleanSetting("-Wsafe-init", "Ensure safe initialization of objects.")
285+
val YcheckInit: Setting[Boolean] = BooleanSetting("-Ysafe-init", "Ensure safe initialization of objects.")
286286

287287
object Whas:
288288
def allOr(s: Setting[Boolean])(using Context): Boolean =
289289
Wall.value || s.value
290290
def valueDiscard(using Context): Boolean = allOr(WvalueDiscard)
291291
def nonUnitStatement(using Context): Boolean = allOr(WNonUnitStatement)
292292
def enumCommentDiscard(using Context): Boolean = allOr(WenumCommentDiscard)
293-
def checkInit(using Context): Boolean = allOr(WcheckInit)
293+
def checkInit(using Context): Boolean = allOr(YcheckInit)
294294

295295
/** -X "Extended" or "Advanced" settings */
296296
private sealed trait XSettings:
@@ -429,7 +429,6 @@ private sealed trait YSettings:
429429
// Experimental language features
430430
val YnoKindPolymorphism: Setting[Boolean] = BooleanSetting("-Yno-kind-polymorphism", "Disable kind polymorphism.")
431431
val YexplicitNulls: Setting[Boolean] = BooleanSetting("-Yexplicit-nulls", "Make reference types non-nullable. Nullable types can be expressed with unions: e.g. String|Null.")
432-
val YcheckInit: Setting[Boolean] = BooleanSetting("-Ysafe-init", "Ensure safe initialization of objects.")
433432
val YrequireTargetName: Setting[Boolean] = BooleanSetting("-Yrequire-targetName", "Warn if an operator is defined without a @targetName annotation.")
434433
val YrecheckTest: Setting[Boolean] = BooleanSetting("-Yrecheck-test", "Run basic rechecking (internal test only).")
435434
val YccDebug: Setting[Boolean] = BooleanSetting("-Ycc-debug", "Used in conjunction with captureChecking language import, debug info for captured references.")

tests/pos-with-compiler-cc/dotc/core/Symbols.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ object Symbols {
8383
ctx.settings.YretainTrees.value ||
8484
denot.owner.isTerm || // no risk of leaking memory after a run for these
8585
denot.isOneOf(InlineOrProxy) || // need to keep inline info
86-
ctx.settings.YcheckInit.value // initialization check
86+
ctx.settings.Whas.checkInit // initialization check
8787

8888
/** The last denotation of this symbol */
8989
private var lastDenot: SymDenotation = _

tests/pos-with-compiler-cc/dotc/transform/init/Checker.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Checker extends Phase:
2828
override val runsAfter = Set(Pickler.name)
2929

3030
override def isEnabled(using Context): Boolean =
31-
super.isEnabled && ctx.settings.YcheckInit.value
31+
super.isEnabled && ctx.settings.Whas.checkInit
3232

3333
override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] =
3434
val checkCtx = ctx.fresh.setPhase(this.start)

tests/warn/i18559b.check

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
8 | val localFile: String = s"${url.##}.tmp" // warn
33
| ^
44
| Access non-initialized value localFile. Calling trace:
5-
| ├── class RemoteFile(url: String) extends AbstractFile: [ i18559b.scala:7 ]
6-
| ^
7-
| ├── abstract class AbstractFile: [ i18559b.scala:3 ]
8-
| ^
9-
| ├── val extension: String = name.substring(4) [ i18559b.scala:5 ]
10-
| ^^^^
11-
| └── def name: String = localFile [ i18559b.scala:9 ]
12-
| ^^^^^^^^^
5+
| -> class RemoteFile(url: String) extends AbstractFile: [ i18559b.scala:7 ]
6+
| ^
7+
| -> abstract class AbstractFile: [ i18559b.scala:3 ]
8+
| ^
9+
| -> val extension: String = name.substring(4) [ i18559b.scala:5 ]
10+
| ^^^^
11+
| -> def name: String = localFile [ i18559b.scala:9 ]
12+
| ^^^^^^^^^

0 commit comments

Comments
 (0)