diff options
author | odersky <odersky@gmail.com> | 2016-02-06 18:01:45 +0100 |
---|---|---|
committer | odersky <odersky@gmail.com> | 2016-02-06 18:01:45 +0100 |
commit | d0056132485c10e0e408668e177a8452c5112d3b (patch) | |
tree | ba4b08f71216dd9c18166db9060bfb9ab2eda871 /src/dotty/tools | |
parent | ffcc27baddb02f3c92e9d22ddfb56d0d30f277d8 (diff) | |
parent | b33babc2398e5013820e21568713fdb6c15aa6fa (diff) | |
download | dotty-d0056132485c10e0e408668e177a8452c5112d3b.tar.gz dotty-d0056132485c10e0e408668e177a8452c5112d3b.tar.bz2 dotty-d0056132485c10e0e408668e177a8452c5112d3b.zip |
Merge pull request #1057 from dotty-staging/fix/hide-stacktraces
Hide stack traces behind -Ydebug
Diffstat (limited to 'src/dotty/tools')
-rw-r--r-- | src/dotty/tools/dotc/config/ScalaSettings.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/printing/PlainPrinter.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/printing/Printers.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/ConsoleReporter.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/PatternMatcher.scala | 2 |
9 files changed, 11 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala index 0c381c077..035b20130 100644 --- a/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -146,10 +146,12 @@ class ScalaSettings extends Settings.SettingGroup { val etaExpandKeepsStar = BooleanSetting("-Yeta-expand-keeps-star", "Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.") val Yinvalidate = StringSetting("-Yinvalidate", "classpath-entry", "Invalidate classpath entry before run", "") val noSelfCheck = BooleanSetting("-Yno-self-type-checks", "Suppress check for self-type conformance among inherited members.") + val YtraceContextCreation = BooleanSetting("-Ytrace-context-creation", "Store stack trace of context creations.") val YshowSuppressedErrors = BooleanSetting("-Yshow-suppressed-errors", "Also show follow-on errors and warnings that are normally supressed.") val Yheartbeat = BooleanSetting("-Yheartbeat", "show heartbeat stack trace of compiler operations.") val Yprintpos = BooleanSetting("-Yprintpos", "show tree positions.") val YnoDeepSubtypes = BooleanSetting("-Yno-deep-subtypes", "throw an exception on deep subtyping call stacks.") + val YplainPrinter = BooleanSetting("-Yplain-printer", "Pretty-print using a plain printer.") val YprintSyms = BooleanSetting("-Yprint-syms", "when printing trees print info in symbols instead of corresponding info in trees.") val YtestPickler = BooleanSetting("-Ytest-pickler", "self-test for pickling functionality; should be used with -Ystop-after:pickler") val YcheckReentrant = BooleanSetting("-Ycheck-reentrant", "check that compiled program does not contain vars that can be accessed from a global root.") diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index b205a40f0..9ccb03b89 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -255,7 +255,7 @@ object Contexts { private var creationTrace: Array[StackTraceElement] = _ private def setCreationTrace() = - if (this.settings.debug.value) + if (this.settings.YtraceContextCreation.value) creationTrace = (new Throwable).getStackTrace().take(20) /** Print all enclosing context's creation stacktraces */ diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 00ad90354..2af3f463d 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -465,7 +465,7 @@ object Denotations { try info.signature catch { // !!! DEBUG case scala.util.control.NonFatal(ex) => - println(s"cannot take signature of ${info.show}") + ctx.println(s"cannot take signature of ${info.show}") throw ex } case _ => Signature.NotAMethod diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index d76f57ba6..12c05b578 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -3387,7 +3387,7 @@ object Types { class MissingType(pre: Type, name: Name)(implicit ctx: Context) extends TypeError( i"""cannot resolve reference to type $pre.$name |the classfile defining the type might be missing from the classpath${otherReason(pre)}""".stripMargin) { - printStackTrace() + if (ctx.debug) printStackTrace() } private def otherReason(pre: Type)(implicit ctx: Context): String = pre match { diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index abf31a006..b1b229768 100644 --- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -188,7 +188,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas val ex = new BadSignature( sm"""error reading Scala signature of $classRoot from $source: |error occurred at position $readIndex: $msg""") - /*if (debug)*/ original.getOrElse(ex).printStackTrace() // !!! DEBUG + if (ctx.debug) original.getOrElse(ex).printStackTrace() throw ex } @@ -425,7 +425,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas owner.info.decls.checkConsistent() if (slowSearch(name).exists) System.err.println(i"**** slow search found: ${slowSearch(name)}") - new Exception().printStackTrace() + if (ctx.debug) Thread.dumpStack() ctx.newStubSymbol(owner, name, source) } } diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala index 8f9d70d4c..6d026dde7 100644 --- a/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -32,7 +32,7 @@ class PlainPrinter(_ctx: Context) extends Printer { protected def recursionLimitExceeded() = { ctx.warning("Exceeded recursion depth attempting to print.") - (new Throwable).printStackTrace + if (ctx.debug) Thread.dumpStack() } /** If true, tweak output so it is the same before and after pickling */ diff --git a/src/dotty/tools/dotc/printing/Printers.scala b/src/dotty/tools/dotc/printing/Printers.scala index 7107ccb78..36043a4ff 100644 --- a/src/dotty/tools/dotc/printing/Printers.scala +++ b/src/dotty/tools/dotc/printing/Printers.scala @@ -8,7 +8,7 @@ trait Printers { this: Context => /** A function creating a printer */ def printer = { val pr = printerFn(this) - if (this.debug) pr.plain else pr + if (this.settings.YplainPrinter.value) pr.plain else pr } } diff --git a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala index e9b9964c3..8f1fbf797 100644 --- a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala +++ b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala @@ -63,7 +63,7 @@ class ConsoleReporter( if (reader != null) { val response = reader.read().asInstanceOf[Char].toLower if (response == 'a' || response == 's') { - (new Exception).printStackTrace() + Thread.dumpStack() if (response == 'a') sys.exit(1) } diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala index 7c8d0a10f..4d626c67b 100644 --- a/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -327,7 +327,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans private[TreeMakers] def incorporateOuterRebinding(outerSubst: Rebindings): Unit = { if (currSub ne null) { ctx.debuglog("BUG: incorporateOuterRebinding called more than once for " + ((this, currSub, outerSubst))) - Thread.dumpStack() + if (ctx.debug) Thread.dumpStack() } else currSub = outerSubst >> rebindings } |