Skip to content

Commit ff3637f

Browse files
authored
Merge pull request #10655 from dotty-staging/cleanup-settings
Clean up settings
2 parents d8bac4e + 4bc743e commit ff3637f

File tree

12 files changed

+15
-28
lines changed

12 files changed

+15
-28
lines changed

compiler/src/dotty/tools/dotc/Compiler.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class Compiler {
148148
def newRun(using Context): Run = {
149149
reset()
150150
val rctx =
151-
if ctx.settings.Ysemanticdb.value then
151+
if ctx.settings.Xsemanticdb.value then
152152
ctx.addMode(Mode.ReadPositions)
153153
else
154154
ctx

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

+3-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait CommonScalaSettings { self: Settings.SettingGroup =>
2222
val classpath: Setting[String] = PathSetting("-classpath", "Specify where to find user class files.", defaultClasspath) withAbbreviation "-cp" withAbbreviation "--class-path"
2323
val outputDir: Setting[AbstractFile] = OutputSetting("-d", "directory|jar", "Destination for generated classfiles.",
2424
new PlainDirectory(Directory(".")))
25-
val priorityclasspath: Setting[String] = PathSetting("-priorityclasspath", "Class path that takes precedence over all other paths (or testing only).", "") withAbbreviation "--priority-class-path"
25+
val priorityclasspath: Setting[String] = PathSetting("-priorityclasspath", "Class path that takes precedence over all other paths (for testing only).", "") withAbbreviation "--priority-class-path"
2626
val color: Setting[String] = ChoiceSetting("-color", "mode", "Colored output", List("always", "never"/*, "auto"*/), "always"/* "auto"*/) withAbbreviation "--color"
2727
val verbose: Setting[Boolean] = BooleanSetting("-verbose", "Output messages about what the compiler is doing.") withAbbreviation "--verbose"
2828
val version: Setting[Boolean] = BooleanSetting("-version", "Print product version and exit.") withAbbreviation "--version"
@@ -92,7 +92,7 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings {
9292

9393
val newSyntax: Setting[Boolean] = BooleanSetting("-new-syntax", "Require `then` and `do` in control expressions.")
9494
val oldSyntax: Setting[Boolean] = BooleanSetting("-old-syntax", "Require `(...)` around conditions.")
95-
val indent: Setting[Boolean] = BooleanSetting("-indent", "Allow significant indentation.")
95+
val indent: Setting[Boolean] = BooleanSetting("-indent", "Together with -rewrite, remove {...} syntax when possible due to significant indentation.")
9696
val noindent: Setting[Boolean] = BooleanSetting("-noindent", "Require classical {...} syntax, indentation is not significant.")
9797
val YindentColons: Setting[Boolean] = BooleanSetting("-Yindent-colons", "Allow colons at ends-of-lines to start indentation blocks.")
9898

@@ -118,12 +118,12 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings {
118118
val XprintSuspension: Setting[Boolean] = BooleanSetting("-Xprint-suspension", "Show when code is suspended until macros are compiled.")
119119
val Xprompt: Setting[Boolean] = BooleanSetting("-Xprompt", "Display a prompt after each error (debugging option).")
120120
val XshowPhases: Setting[Boolean] = BooleanSetting("-Xshow-phases", "Print all compiler phases.")
121-
val XreplLineWidth: Setting[Int] = IntSetting("-Xrepl-line-width", "Maximal number of columns per line for REPL output.", 390)
122121
val XreplDisableDisplay: Setting[Boolean] = BooleanSetting("-Xrepl-disable-display", "Do not display definitions in REPL.")
123122
val XfatalWarnings: Setting[Boolean] = BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.")
124123
val XverifySignatures: Setting[Boolean] = BooleanSetting("-Xverify-signatures", "Verify generic signatures in generated bytecode.")
125124
val XignoreScala2Macros: Setting[Boolean] = BooleanSetting("-Xignore-scala2-macros", "Ignore errors when compiling code that calls Scala2 macros, these will fail at runtime.")
126125
val XimportSuggestionTimeout: Setting[Int] = IntSetting("-Ximport-suggestion-timeout", "Timeout (in ms) for searching for import suggestions when errors are reported.", 8000)
126+
val Xsemanticdb: Setting[Boolean] = BooleanSetting("-Xsemanticdb", "Store information in SemanticDB.").withAbbreviation("-Ysemanticdb")
127127

128128
val XmixinForceForwarders = ChoiceSetting(
129129
name = "-Xmixin-force-forwarders",
@@ -138,7 +138,6 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings {
138138
}
139139

140140
/** -Y "Private" settings */
141-
val YoverrideVars: Setting[Boolean] = BooleanSetting("-Yoverride-vars", "Allow vars to be overridden.")
142141
val Yhelp: Setting[Boolean] = BooleanSetting("-Y", "Print a synopsis of private options.")
143142
val Ycheck: Setting[List[String]] = PhasesSetting("-Ycheck", "Check the tree at the end of")
144143
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 {
165164
val Ydumpclasses: Setting[String] = StringSetting("-Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", "")
166165
val YstopAfter: Setting[List[String]] = PhasesSetting("-Ystop-after", "Stop after") withAbbreviation ("-stop") // backward compat
167166
val YstopBefore: Setting[List[String]] = PhasesSetting("-Ystop-before", "Stop before") // stop before erasure as long as we have not debugged it fully
168-
val YtraceContextCreation: Setting[Boolean] = BooleanSetting("-Ytrace-context-creation", "Store stack trace of context creations.")
169167
val YshowSuppressedErrors: Setting[Boolean] = BooleanSetting("-Yshow-suppressed-errors", "Also show follow-on errors and warnings that are normally suppressed.")
170168
val YdetailedStats: Setting[Boolean] = BooleanSetting("-Ydetailed-stats", "Show detailed internal compiler stats (needs Stats.enabled to be set to true).")
171169
val YkindProjector: Setting[Boolean] = BooleanSetting("-Ykind-projector", "Allow `*` as wildcard to be compatible with kind projector.")
@@ -178,17 +176,14 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings {
178176
val YprintDebug: Setting[Boolean] = BooleanSetting("-Yprint-debug", "When printing trees, print some extra information useful for debugging.")
179177
val YprintDebugOwners: Setting[Boolean] = BooleanSetting("-Yprint-debug-owners", "When printing trees, print owners of definitions.")
180178
val YshowPrintErrors: Setting[Boolean] = BooleanSetting("-Yshow-print-errors", "Don't suppress exceptions thrown during tree printing.")
181-
val YshowRawQuoteTrees: Setting[Boolean] = BooleanSetting("-Yshow-raw-tree", "Don't remove quote artifacts.")
182179
val YtestPickler: Setting[Boolean] = BooleanSetting("-Ytest-pickler", "Self-test for pickling functionality; should be used with -Ystop-after:pickler.")
183-
val YparallelPickler: Setting[Boolean] = BooleanSetting("-Yparallel-pickler", "Run part of the pickling phase in parallel, disable because it breaks some tests.")
184180
val YcheckReentrant: Setting[Boolean] = BooleanSetting("-Ycheck-reentrant", "Check that compiled program does not contain vars that can be accessed from a global root.")
185181
val YdropComments: Setting[Boolean] = BooleanSetting("-Ydrop-comments", "Drop comments when scanning source files.")
186182
val YcookComments: Setting[Boolean] = BooleanSetting("-Ycook-comments", "Cook the comments (type check `@usecase`, etc.)")
187183
val YforceSbtPhases: Setting[Boolean] = BooleanSetting("-Yforce-sbt-phases", "Run the phases used by sbt for incremental compilation (ExtractDependencies and ExtractAPI) even if the compiler is ran outside of sbt, for debugging.")
188184
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.")
189185
val YcheckAllPatmat: Setting[Boolean] = BooleanSetting("-Ycheck-all-patmat", "Check exhaustivity and redundancy of all pattern matching (used for testing the algorithm).")
190186
val YretainTrees: Setting[Boolean] = BooleanSetting("-Yretain-trees", "Retain trees for top-level classes, accessible from ClassSymbol#tree")
191-
val Ysemanticdb: Setting[Boolean] = BooleanSetting("-Ysemanticdb", "Store information in SemanticDB.")
192187
val YshowTreeIds: Setting[Boolean] = BooleanSetting("-Yshow-tree-ids", "Uniquely tag all tree nodes in debugging output.")
193188
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")
194189

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ object Contexts {
338338
private var creationTrace: Array[StackTraceElement] = _
339339
340340
private def setCreationTrace() =
341-
if (this.settings.YtraceContextCreation.value)
342-
creationTrace = (new Throwable).getStackTrace().take(20)
341+
creationTrace = (new Throwable).getStackTrace().take(20)
343342
344343
/** Print all enclosing context's creation stacktraces */
345344
def printCreationTraces() = {

compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ExtractSemanticDB extends Phase:
3535
override val phaseName: String = ExtractSemanticDB.name
3636

3737
override def isRunnable(using Context) =
38-
super.isRunnable && ctx.settings.Ysemanticdb.value
38+
super.isRunnable && ctx.settings.Xsemanticdb.value
3939

4040
// Check not needed since it does not transform trees
4141
override def isCheckable: Boolean = false

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

+2-6
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,8 @@ object RefChecks {
413413
else if (other.is(AbsOverride) && other.isIncompleteIn(clazz) && !member.is(AbsOverride))
414414
overrideError("needs `abstract override` modifiers")
415415
else if (member.is(Override) && other.is(Accessor) &&
416-
other.accessedFieldOrGetter.is(Mutable, butNot = Lazy)) {
417-
// !?! this is not covered by the spec. We need to resolve this either by changing the spec or removing the test here.
418-
// !!! is there a !?! convention? I'm !!!ing this to make sure it turns up on my searches.
419-
if (!ctx.settings.YoverrideVars.value)
420-
overrideError("cannot override a mutable variable")
421-
}
416+
other.accessedFieldOrGetter.is(Mutable, butNot = Lazy))
417+
overrideError("cannot override a mutable variable")
422418
else if (member.isAnyOverride &&
423419
!(member.owner.thisType.baseClasses exists (_ isSubClass other.owner)) &&
424420
!member.is(Deferred) && !other.is(Deferred) &&

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class BootstrappedOnlyCompilationTests extends ParallelTesting {
3535
aggregateTests(
3636
compileFilesInDir("tests/bench", defaultOptions),
3737
compileFilesInDir("tests/pos-macros", defaultOptions),
38-
compileFilesInDir("tests/pos-custom-args/semanticdb", defaultOptions.and("-Ysemanticdb")),
38+
compileFilesInDir("tests/pos-custom-args/semanticdb", defaultOptions.and("-Xsemanticdb")),
3939
).checkCompile()
4040
}
4141

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class CompilationTests {
232232
Properties.compilerInterface, Properties.scalaLibrary, Properties.scalaAsm,
233233
Properties.dottyInterfaces, Properties.jlineTerminal, Properties.jlineReader,
234234
).mkString(File.pathSeparator),
235-
Array("-Ycheck-reentrant", "-language:postfixOps", "-Ysemanticdb")
235+
Array("-Ycheck-reentrant", "-language:postfixOps", "-Xsemanticdb")
236236
)
237237

238238
val libraryDirs = List(Paths.get("library/src"), Paths.get("library/src-bootstrapped"))

compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class SemanticdbTests:
107107
val exitJava = javac.run(null, null, null, javaArgs:_*)
108108
assert(exitJava == 0, "java compiler has errors")
109109
val args = Array(
110-
"-Ysemanticdb",
110+
"-Xsemanticdb",
111111
"-d", target.toString,
112112
"-feature",
113113
"-deprecation",

compiler/test/dotty/tools/vulpix/TestConfiguration.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ object TestConfiguration {
1717
"-Yno-deep-subtypes",
1818
"-Yno-double-bindings",
1919
"-Yforce-sbt-phases",
20-
"-Ysemanticdb",
20+
"-Xsemanticdb",
2121
"-Xverify-signatures"
2222
)
2323

docs/docs/contributing/testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ with `with-compiler` in their name.
148148

149149
### SemanticDB tests
150150

151-
The output of the `extractSemanticDB` phase, enabled with `-Ysemanticdb` is tested with the bootstrapped JUnit test
151+
The output of the `extractSemanticDB` phase, enabled with `-Xsemanticdb` is tested with the bootstrapped JUnit test
152152
`dotty.tools.dotc.semanticdb.SemanticdbTests`. It uses source files in `tests/semanticdb/expect` to generate
153153
two kinds of output file that are compared with "expect files": placement of semanticdb symbol occurrences inline in
154154
sourcecode (`*.expect.scala`), for human verification by inspection; and secondly metap formatted output which outputs

staging/src/scala/quoted/staging/QuoteDriver.scala

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ private class QuoteDriver(appClassloader: ClassLoader) extends Driver:
6060
ictx
6161

6262
private def setToolboxSettings(ctx: FreshContext, settings: Toolbox.Settings): ctx.type =
63-
ctx.setSetting(ctx.settings.YshowRawQuoteTrees, settings.showRawTree)
6463
// An error in the generated code is a bug in the compiler
6564
// Setting the throwing reporter however will report any exception
6665
ctx.setReporter(new ThrowingReporter(ctx.reporter))

staging/src/scala/quoted/staging/Toolbox.scala

+2-4
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,21 @@ object Toolbox:
4444
end new
4545

4646
/** Setting of the Toolbox instance. */
47-
case class Settings private (outDir: Option[String], showRawTree: Boolean, compilerArgs: List[String])
47+
case class Settings private (outDir: Option[String], compilerArgs: List[String])
4848

4949
object Settings:
5050

5151
implicit def default: Settings = make()
5252

5353
/** Make toolbox settings
5454
* @param outDir Output directory for the compiled quote. If set to None the output will be in memory
55-
* @param showRawTree Do not remove quote tree artifacts
5655
* @param compilerArgs Compiler arguments. Use only if you know what you are doing.
5756
*/
5857
def make( // TODO avoid using default parameters (for binary compat)
59-
showRawTree: Boolean = false,
6058
outDir: Option[String] = None,
6159
compilerArgs: List[String] = Nil
6260
): Settings =
63-
new Settings(outDir, showRawTree, compilerArgs)
61+
new Settings(outDir, compilerArgs)
6462

6563
end Settings
6664

0 commit comments

Comments
 (0)