diff --git a/compiler/src/dotty/tools/dotc/Compiler.scala b/compiler/src/dotty/tools/dotc/Compiler.scala index e42a5f091e9c..6dc8e33402a4 100644 --- a/compiler/src/dotty/tools/dotc/Compiler.scala +++ b/compiler/src/dotty/tools/dotc/Compiler.scala @@ -148,7 +148,7 @@ class Compiler { def newRun(using Context): Run = { reset() val rctx = - if ctx.settings.Ysemanticdb.value then + if ctx.settings.Xsemanticdb.value then ctx.addMode(Mode.ReadPositions) else ctx diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 4b42d4206cfc..b2e5810be0c5 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -22,7 +22,7 @@ trait CommonScalaSettings { self: Settings.SettingGroup => val classpath: Setting[String] = PathSetting("-classpath", "Specify where to find user class files.", defaultClasspath) withAbbreviation "-cp" withAbbreviation "--class-path" val outputDir: Setting[AbstractFile] = OutputSetting("-d", "directory|jar", "Destination for generated classfiles.", new PlainDirectory(Directory("."))) - val priorityclasspath: Setting[String] = PathSetting("-priorityclasspath", "Class path that takes precedence over all other paths (or testing only).", "") withAbbreviation "--priority-class-path" + val priorityclasspath: Setting[String] = PathSetting("-priorityclasspath", "Class path that takes precedence over all other paths (for testing only).", "") withAbbreviation "--priority-class-path" val color: Setting[String] = ChoiceSetting("-color", "mode", "Colored output", List("always", "never"/*, "auto"*/), "always"/* "auto"*/) withAbbreviation "--color" val verbose: Setting[Boolean] = BooleanSetting("-verbose", "Output messages about what the compiler is doing.") withAbbreviation "--verbose" val version: Setting[Boolean] = BooleanSetting("-version", "Print product version and exit.") withAbbreviation "--version" @@ -92,7 +92,7 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings { val newSyntax: Setting[Boolean] = BooleanSetting("-new-syntax", "Require `then` and `do` in control expressions.") val oldSyntax: Setting[Boolean] = BooleanSetting("-old-syntax", "Require `(...)` around conditions.") - val indent: Setting[Boolean] = BooleanSetting("-indent", "Allow significant indentation.") + val indent: Setting[Boolean] = BooleanSetting("-indent", "Together with -rewrite, remove {...} syntax when possible due to significant indentation.") val noindent: Setting[Boolean] = BooleanSetting("-noindent", "Require classical {...} syntax, indentation is not significant.") val YindentColons: Setting[Boolean] = BooleanSetting("-Yindent-colons", "Allow colons at ends-of-lines to start indentation blocks.") @@ -118,12 +118,12 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings { val XprintSuspension: Setting[Boolean] = BooleanSetting("-Xprint-suspension", "Show when code is suspended until macros are compiled.") val Xprompt: Setting[Boolean] = BooleanSetting("-Xprompt", "Display a prompt after each error (debugging option).") val XshowPhases: Setting[Boolean] = BooleanSetting("-Xshow-phases", "Print all compiler phases.") - val XreplLineWidth: Setting[Int] = IntSetting("-Xrepl-line-width", "Maximal number of columns per line for REPL output.", 390) val XreplDisableDisplay: Setting[Boolean] = BooleanSetting("-Xrepl-disable-display", "Do not display definitions in REPL.") val XfatalWarnings: Setting[Boolean] = BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.") val XverifySignatures: Setting[Boolean] = BooleanSetting("-Xverify-signatures", "Verify generic signatures in generated bytecode.") val XignoreScala2Macros: Setting[Boolean] = BooleanSetting("-Xignore-scala2-macros", "Ignore errors when compiling code that calls Scala2 macros, these will fail at runtime.") val XimportSuggestionTimeout: Setting[Int] = IntSetting("-Ximport-suggestion-timeout", "Timeout (in ms) for searching for import suggestions when errors are reported.", 8000) + val Xsemanticdb: Setting[Boolean] = BooleanSetting("-Xsemanticdb", "Store information in SemanticDB.").withAbbreviation("-Ysemanticdb") val XmixinForceForwarders = ChoiceSetting( name = "-Xmixin-force-forwarders", @@ -138,7 +138,6 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings { } /** -Y "Private" settings */ - val YoverrideVars: Setting[Boolean] = BooleanSetting("-Yoverride-vars", "Allow vars to be overridden.") val Yhelp: Setting[Boolean] = BooleanSetting("-Y", "Print a synopsis of private options.") val Ycheck: Setting[List[String]] = PhasesSetting("-Ycheck", "Check the tree at the end of") val YcheckMods: Setting[Boolean] = BooleanSetting("-Ycheck-mods", "Check that symbols and their defining trees have modifiers in sync.") @@ -165,7 +164,6 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings { val Ydumpclasses: Setting[String] = StringSetting("-Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "") val YstopAfter: Setting[List[String]] = PhasesSetting("-Ystop-after", "Stop after") withAbbreviation ("-stop") // backward compat val YstopBefore: Setting[List[String]] = PhasesSetting("-Ystop-before", "Stop before") // stop before erasure as long as we have not debugged it fully - val YtraceContextCreation: Setting[Boolean] = BooleanSetting("-Ytrace-context-creation", "Store stack trace of context creations.") val YshowSuppressedErrors: Setting[Boolean] = BooleanSetting("-Yshow-suppressed-errors", "Also show follow-on errors and warnings that are normally suppressed.") val YdetailedStats: Setting[Boolean] = BooleanSetting("-Ydetailed-stats", "Show detailed internal compiler stats (needs Stats.enabled to be set to true).") val YkindProjector: Setting[Boolean] = BooleanSetting("-Ykind-projector", "Allow `*` as wildcard to be compatible with kind projector.") @@ -178,9 +176,7 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings { val YprintDebug: Setting[Boolean] = BooleanSetting("-Yprint-debug", "When printing trees, print some extra information useful for debugging.") val YprintDebugOwners: Setting[Boolean] = BooleanSetting("-Yprint-debug-owners", "When printing trees, print owners of definitions.") val YshowPrintErrors: Setting[Boolean] = BooleanSetting("-Yshow-print-errors", "Don't suppress exceptions thrown during tree printing.") - val YshowRawQuoteTrees: Setting[Boolean] = BooleanSetting("-Yshow-raw-tree", "Don't remove quote artifacts.") val YtestPickler: Setting[Boolean] = BooleanSetting("-Ytest-pickler", "Self-test for pickling functionality; should be used with -Ystop-after:pickler.") - val YparallelPickler: Setting[Boolean] = BooleanSetting("-Yparallel-pickler", "Run part of the pickling phase in parallel, disable because it breaks some tests.") val YcheckReentrant: Setting[Boolean] = BooleanSetting("-Ycheck-reentrant", "Check that compiled program does not contain vars that can be accessed from a global root.") val YdropComments: Setting[Boolean] = BooleanSetting("-Ydrop-comments", "Drop comments when scanning source files.") val YcookComments: Setting[Boolean] = BooleanSetting("-Ycook-comments", "Cook the comments (type check `@usecase`, etc.)") @@ -188,7 +184,6 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings { val YdumpSbtInc: Setting[Boolean] = BooleanSetting("-Ydump-sbt-inc", "For every compiled foo.scala, output the API representation and dependencies used for sbt incremental compilation in foo.inc, implies -Yforce-sbt-phases.") val YcheckAllPatmat: Setting[Boolean] = BooleanSetting("-Ycheck-all-patmat", "Check exhaustivity and redundancy of all pattern matching (used for testing the algorithm).") val YretainTrees: Setting[Boolean] = BooleanSetting("-Yretain-trees", "Retain trees for top-level classes, accessible from ClassSymbol#tree") - val Ysemanticdb: Setting[Boolean] = BooleanSetting("-Ysemanticdb", "Store information in SemanticDB.") val YshowTreeIds: Setting[Boolean] = BooleanSetting("-Yshow-tree-ids", "Uniquely tag all tree nodes in debugging output.") val YfromTastyIgnoreList: Setting[List[String]] = MultiStringSetting("-Yfrom-tasty-ignore-list", "file", "List of `tasty` files in jar files that will not be loaded when using -from-tasty") diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index fa0176856885..467cdafe1529 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -338,8 +338,7 @@ object Contexts { private var creationTrace: Array[StackTraceElement] = _ private def setCreationTrace() = - if (this.settings.YtraceContextCreation.value) - creationTrace = (new Throwable).getStackTrace().take(20) + creationTrace = (new Throwable).getStackTrace().take(20) /** Print all enclosing context's creation stacktraces */ def printCreationTraces() = { diff --git a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala index 22ed5dd23426..30edf5427e57 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala @@ -35,7 +35,7 @@ class ExtractSemanticDB extends Phase: override val phaseName: String = ExtractSemanticDB.name override def isRunnable(using Context) = - super.isRunnable && ctx.settings.Ysemanticdb.value + super.isRunnable && ctx.settings.Xsemanticdb.value // Check not needed since it does not transform trees override def isCheckable: Boolean = false diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index 3016cbaa18a8..46f6b18f7d37 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -413,12 +413,8 @@ object RefChecks { else if (other.is(AbsOverride) && other.isIncompleteIn(clazz) && !member.is(AbsOverride)) overrideError("needs `abstract override` modifiers") else if (member.is(Override) && other.is(Accessor) && - other.accessedFieldOrGetter.is(Mutable, butNot = Lazy)) { - // !?! this is not covered by the spec. We need to resolve this either by changing the spec or removing the test here. - // !!! is there a !?! convention? I'm !!!ing this to make sure it turns up on my searches. - if (!ctx.settings.YoverrideVars.value) - overrideError("cannot override a mutable variable") - } + other.accessedFieldOrGetter.is(Mutable, butNot = Lazy)) + overrideError("cannot override a mutable variable") else if (member.isAnyOverride && !(member.owner.thisType.baseClasses exists (_ isSubClass other.owner)) && !member.is(Deferred) && !other.is(Deferred) && diff --git a/compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala b/compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala index 2cc464a1fe00..80dfa07fdfe9 100644 --- a/compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala @@ -35,7 +35,7 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting { aggregateTests( compileFilesInDir("tests/bench", defaultOptions), compileFilesInDir("tests/pos-macros", defaultOptions), - compileFilesInDir("tests/pos-custom-args/semanticdb", defaultOptions.and("-Ysemanticdb")), + compileFilesInDir("tests/pos-custom-args/semanticdb", defaultOptions.and("-Xsemanticdb")), ).checkCompile() } diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index a1c68e5c76c0..7ecb6be11e6b 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -232,7 +232,7 @@ class CompilationTests { Properties.compilerInterface, Properties.scalaLibrary, Properties.scalaAsm, Properties.dottyInterfaces, Properties.jlineTerminal, Properties.jlineReader, ).mkString(File.pathSeparator), - Array("-Ycheck-reentrant", "-language:postfixOps", "-Ysemanticdb") + Array("-Ycheck-reentrant", "-language:postfixOps", "-Xsemanticdb") ) val libraryDirs = List(Paths.get("library/src"), Paths.get("library/src-bootstrapped")) diff --git a/compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala b/compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala index 1f7785653fa6..5deeaed114a8 100644 --- a/compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala +++ b/compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala @@ -107,7 +107,7 @@ class SemanticdbTests: val exitJava = javac.run(null, null, null, javaArgs:_*) assert(exitJava == 0, "java compiler has errors") val args = Array( - "-Ysemanticdb", + "-Xsemanticdb", "-d", target.toString, "-feature", "-deprecation", diff --git a/compiler/test/dotty/tools/vulpix/TestConfiguration.scala b/compiler/test/dotty/tools/vulpix/TestConfiguration.scala index e4348e198941..b73c3756fd89 100644 --- a/compiler/test/dotty/tools/vulpix/TestConfiguration.scala +++ b/compiler/test/dotty/tools/vulpix/TestConfiguration.scala @@ -17,7 +17,7 @@ object TestConfiguration { "-Yno-deep-subtypes", "-Yno-double-bindings", "-Yforce-sbt-phases", - "-Ysemanticdb", + "-Xsemanticdb", "-Xverify-signatures" ) diff --git a/docs/docs/contributing/testing.md b/docs/docs/contributing/testing.md index 7b1cb58fa4bc..c0fdca5f10dc 100644 --- a/docs/docs/contributing/testing.md +++ b/docs/docs/contributing/testing.md @@ -148,7 +148,7 @@ with `with-compiler` in their name. ### SemanticDB tests -The output of the `extractSemanticDB` phase, enabled with `-Ysemanticdb` is tested with the bootstrapped JUnit test +The output of the `extractSemanticDB` phase, enabled with `-Xsemanticdb` is tested with the bootstrapped JUnit test `dotty.tools.dotc.semanticdb.SemanticdbTests`. It uses source files in `tests/semanticdb/expect` to generate two kinds of output file that are compared with "expect files": placement of semanticdb symbol occurrences inline in sourcecode (`*.expect.scala`), for human verification by inspection; and secondly metap formatted output which outputs diff --git a/staging/src/scala/quoted/staging/QuoteDriver.scala b/staging/src/scala/quoted/staging/QuoteDriver.scala index 505657fdbbb5..9bfb4dbdd287 100644 --- a/staging/src/scala/quoted/staging/QuoteDriver.scala +++ b/staging/src/scala/quoted/staging/QuoteDriver.scala @@ -60,7 +60,6 @@ private class QuoteDriver(appClassloader: ClassLoader) extends Driver: ictx private def setToolboxSettings(ctx: FreshContext, settings: Toolbox.Settings): ctx.type = - ctx.setSetting(ctx.settings.YshowRawQuoteTrees, settings.showRawTree) // An error in the generated code is a bug in the compiler // Setting the throwing reporter however will report any exception ctx.setReporter(new ThrowingReporter(ctx.reporter)) diff --git a/staging/src/scala/quoted/staging/Toolbox.scala b/staging/src/scala/quoted/staging/Toolbox.scala index e8fa611455c6..b3071c149557 100644 --- a/staging/src/scala/quoted/staging/Toolbox.scala +++ b/staging/src/scala/quoted/staging/Toolbox.scala @@ -44,7 +44,7 @@ object Toolbox: end new /** Setting of the Toolbox instance. */ - case class Settings private (outDir: Option[String], showRawTree: Boolean, compilerArgs: List[String]) + case class Settings private (outDir: Option[String], compilerArgs: List[String]) object Settings: @@ -52,15 +52,13 @@ object Toolbox: /** Make toolbox settings * @param outDir Output directory for the compiled quote. If set to None the output will be in memory - * @param showRawTree Do not remove quote tree artifacts * @param compilerArgs Compiler arguments. Use only if you know what you are doing. */ def make( // TODO avoid using default parameters (for binary compat) - showRawTree: Boolean = false, outDir: Option[String] = None, compilerArgs: List[String] = Nil ): Settings = - new Settings(outDir, showRawTree, compilerArgs) + new Settings(outDir, compilerArgs) end Settings