From f372d14cf96f533a0a4d311d6f9b4d1f016d302f Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Tue, 3 Dec 2024 20:58:47 +0100 Subject: [PATCH] Fix compilation --- .../dotty/tools/dotc/config/ScalaSettings.scala | 5 ++--- .../pos-with-compiler-cc/dotc/core/Symbols.scala | 2 +- .../dotc/transform/init/Checker.scala | 2 +- tests/warn/i18559b.check | 16 ++++++++-------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 28df97feb1c3..99568d2eee19 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -282,7 +282,7 @@ private sealed trait WarningSettings: |to prevent the shell from expanding patterns.""".stripMargin, ) - val WcheckInit: Setting[Boolean] = BooleanSetting("-Wsafe-init", "Ensure safe initialization of objects.") + val YcheckInit: Setting[Boolean] = BooleanSetting("-Ysafe-init", "Ensure safe initialization of objects.") object Whas: def allOr(s: Setting[Boolean])(using Context): Boolean = @@ -290,7 +290,7 @@ private sealed trait WarningSettings: def valueDiscard(using Context): Boolean = allOr(WvalueDiscard) def nonUnitStatement(using Context): Boolean = allOr(WNonUnitStatement) def enumCommentDiscard(using Context): Boolean = allOr(WenumCommentDiscard) - def checkInit(using Context): Boolean = allOr(WcheckInit) + def checkInit(using Context): Boolean = allOr(YcheckInit) /** -X "Extended" or "Advanced" settings */ private sealed trait XSettings: @@ -429,7 +429,6 @@ private sealed trait YSettings: // Experimental language features val YnoKindPolymorphism: Setting[Boolean] = BooleanSetting("-Yno-kind-polymorphism", "Disable kind polymorphism.") val YexplicitNulls: Setting[Boolean] = BooleanSetting("-Yexplicit-nulls", "Make reference types non-nullable. Nullable types can be expressed with unions: e.g. String|Null.") - val YcheckInit: Setting[Boolean] = BooleanSetting("-Ysafe-init", "Ensure safe initialization of objects.") val YrequireTargetName: Setting[Boolean] = BooleanSetting("-Yrequire-targetName", "Warn if an operator is defined without a @targetName annotation.") val YrecheckTest: Setting[Boolean] = BooleanSetting("-Yrecheck-test", "Run basic rechecking (internal test only).") val YccDebug: Setting[Boolean] = BooleanSetting("-Ycc-debug", "Used in conjunction with captureChecking language import, debug info for captured references.") diff --git a/tests/pos-with-compiler-cc/dotc/core/Symbols.scala b/tests/pos-with-compiler-cc/dotc/core/Symbols.scala index e4fa93b5bf05..1f0a9ad6595c 100644 --- a/tests/pos-with-compiler-cc/dotc/core/Symbols.scala +++ b/tests/pos-with-compiler-cc/dotc/core/Symbols.scala @@ -83,7 +83,7 @@ object Symbols { ctx.settings.YretainTrees.value || denot.owner.isTerm || // no risk of leaking memory after a run for these denot.isOneOf(InlineOrProxy) || // need to keep inline info - ctx.settings.YcheckInit.value // initialization check + ctx.settings.Whas.checkInit // initialization check /** The last denotation of this symbol */ private var lastDenot: SymDenotation = _ diff --git a/tests/pos-with-compiler-cc/dotc/transform/init/Checker.scala b/tests/pos-with-compiler-cc/dotc/transform/init/Checker.scala index 1efb3c88149e..94df04d8754d 100644 --- a/tests/pos-with-compiler-cc/dotc/transform/init/Checker.scala +++ b/tests/pos-with-compiler-cc/dotc/transform/init/Checker.scala @@ -28,7 +28,7 @@ class Checker extends Phase: override val runsAfter = Set(Pickler.name) override def isEnabled(using Context): Boolean = - super.isEnabled && ctx.settings.YcheckInit.value + super.isEnabled && ctx.settings.Whas.checkInit override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] = val checkCtx = ctx.fresh.setPhase(this.start) diff --git a/tests/warn/i18559b.check b/tests/warn/i18559b.check index 710df8234a9a..a270c231e515 100644 --- a/tests/warn/i18559b.check +++ b/tests/warn/i18559b.check @@ -2,11 +2,11 @@ 8 | val localFile: String = s"${url.##}.tmp" // warn | ^ | Access non-initialized value localFile. Calling trace: - | ├── class RemoteFile(url: String) extends AbstractFile: [ i18559b.scala:7 ] - | │ ^ - | ├── abstract class AbstractFile: [ i18559b.scala:3 ] - | │ ^ - | ├── val extension: String = name.substring(4) [ i18559b.scala:5 ] - | │ ^^^^ - | └── def name: String = localFile [ i18559b.scala:9 ] - | ^^^^^^^^^ + | -> class RemoteFile(url: String) extends AbstractFile: [ i18559b.scala:7 ] + | ^ + | -> abstract class AbstractFile: [ i18559b.scala:3 ] + | ^ + | -> val extension: String = name.substring(4) [ i18559b.scala:5 ] + | ^^^^ + | -> def name: String = localFile [ i18559b.scala:9 ] + | ^^^^^^^^^