Skip to content

Commit

Permalink
Merge -Xno-decode-stacktraces with -Xno-enrich-error-messages (#22208)
Browse files Browse the repository at this point in the history
The two mean very similar things and -Xno-enrich-error-messages is
better documented, so more people will know to reach for it.

Keep -Xno-decode-stacktraces as an alias for -Xno-enrich-error-messages
for now in order to maintain backwards compatibility
  • Loading branch information
odersky authored Dec 17, 2024
2 parents 7dc5008 + 8b7c98c commit 266253d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
5 changes: 2 additions & 3 deletions compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,7 @@ private sealed trait XSettings:
val XreadComments: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xread-docs", "Read documentation from tasty.")

/** Area-specific debug output */
val XnoDecodeStacktraces: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.")
val XnoEnrichErrorMessages: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xno-enrich-error-messages", "Show raw error messages, instead of enriching them with contextual information.")
val XnoEnrichErrorMessages: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xno-enrich-error-messages", "Show raw error messages, instead of enriching them with contextual information.", aliases = List("Xno-decode-stacktraces"))
val XdebugMacros: Setting[Boolean] = BooleanSetting(AdvancedSetting, "Xdebug-macros", "Show debug info when quote pattern match fails")

/** Pipeline compilation options */
Expand Down Expand Up @@ -487,7 +486,7 @@ private sealed trait YSettings:
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YreadComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Yread-docs", "Read documentation from tasty.", deprecation = Deprecation.renamed("-Xread-docs"))
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YnoDecodeStacktraces: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.", deprecation = Deprecation.renamed("-Xno-decode-stacktraces"))
val YnoDecodeStacktraces: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.", deprecation = Deprecation.renamed("-Xno-enrich-error-messages"))
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YnoEnrichErrorMessages: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-enrich-error-messages", "Show raw error messages, instead of enriching them with contextual information.", deprecation = Deprecation.renamed("-Xno-enrich-error-messages"))
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/core/TypeErrors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ extends TypeError:
em"""Recursion limit exceeded.
|Maybe there is an illegal cyclic reference?
|If that's not the case, you could also try to increase the stacksize using the -Xss JVM option.
|For the unprocessed stack trace, compile with -Xno-decode-stacktraces.
|For the unprocessed stack trace, compile with -Xno-enrich-error-messages.
|A recurring operation is (inner to outer):
|${opsString(mostCommon).stripMargin}"""

Expand All @@ -137,7 +137,7 @@ object handleRecursive:
e

def apply(op: String, details: => String, exc: Throwable, weight: Int = 1)(using Context): Nothing =
if ctx.settings.XnoDecodeStacktraces.value then
if ctx.settings.XnoEnrichErrorMessages.value then
throw exc
else exc match
case _: RecursionOverflow =>
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
}
catch
case ex: Throwable =>
if !ctx.settings.XnoDecodeStacktraces.value
if !ctx.settings.XnoEnrichErrorMessages.value
&& handleRecursive.underlyingStackOverflowOrNull(ex) != null then
throw StackSizeExceeded(mdef)
else
Expand Down Expand Up @@ -941,7 +941,7 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
em"""Recursion limit exceeded while pickling ${ex.mdef}
|in ${ex.mdef.symbol.showLocated}.
|You could try to increase the stacksize using the -Xss JVM option.
|For the unprocessed stack trace, compile with -Xno-decode-stacktraces.""",
|For the unprocessed stack trace, compile with -Xno-enrich-error-messages.""",
ex.mdef.srcPos)

def missing = forwardSymRefs.keysIterator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class ScalaSettingsTests:
createTestCase(settings.YdropComments , settings.XdropComments),
createTestCase(settings.YcookComments , settings.XcookComments),
createTestCase(settings.YreadComments , settings.XreadComments),
createTestCase(settings.YnoDecodeStacktraces , settings.XnoDecodeStacktraces),
createTestCase(settings.YnoDecodeStacktraces , settings.XnoEnrichErrorMessages),
createTestCase(settings.YnoEnrichErrorMessages, settings.XnoEnrichErrorMessages),
createTestCase(settings.YdebugMacros , settings.XdebugMacros),
// createTestCase(settings.YjavaTasty , settings.XjavaTasty),
Expand Down Expand Up @@ -134,7 +134,7 @@ class ScalaSettingsTests:
createTestCase(settings.YdropComments , settings.XdropComments),
createTestCase(settings.YcookComments , settings.XcookComments),
createTestCase(settings.YreadComments , settings.XreadComments),
createTestCase(settings.YnoDecodeStacktraces , settings.XnoDecodeStacktraces),
createTestCase(settings.YnoDecodeStacktraces , settings.XnoEnrichErrorMessages),
createTestCase(settings.YnoEnrichErrorMessages, settings.XnoEnrichErrorMessages),
createTestCase(settings.YdebugMacros , settings.XdebugMacros),
// createTestCase(settings.YjavaTasty , settings.XjavaTasty),
Expand Down Expand Up @@ -175,7 +175,7 @@ class ScalaSettingsTests:
createTestCase(settings.YdropComments , settings.XdropComments),
createTestCase(settings.YcookComments , settings.XcookComments),
createTestCase(settings.YreadComments , settings.XreadComments),
createTestCase(settings.YnoDecodeStacktraces , settings.XnoDecodeStacktraces),
createTestCase(settings.YnoDecodeStacktraces , settings.XnoEnrichErrorMessages),
createTestCase(settings.YnoEnrichErrorMessages, settings.XnoEnrichErrorMessages),
createTestCase(settings.YdebugMacros , settings.XdebugMacros),
// createTestCase(settings.YjavaTasty , settings.XjavaTasty),
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i2887b.check
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
| Recursion limit exceeded.
| Maybe there is an illegal cyclic reference?
| If that's not the case, you could also try to increase the stacksize using the -Xss JVM option.
| For the unprocessed stack trace, compile with -Xno-decode-stacktraces.
| For the unprocessed stack trace, compile with -Xno-enrich-error-messages.
| A recurring operation is (inner to outer):
|
| try to instantiate Z[Z]
Expand Down

0 comments on commit 266253d

Please sign in to comment.