diff options
author | Martin Odersky <odersky@gmail.com> | 2013-04-04 15:18:38 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-04-04 15:18:38 +0200 |
commit | 3dfdb907759b6344b6c0544b5378847ebe252a71 (patch) | |
tree | e4ca69e1833f7f15238e6e9d45c709cad2ebe360 /src/dotty/tools/dotc | |
parent | e8b9ef29f6e0a0ba4f0e51943c80ba2974b0e27e (diff) | |
download | dotty-3dfdb907759b6344b6c0544b5378847ebe252a71.tar.gz dotty-3dfdb907759b6344b6c0544b5378847ebe252a71.tar.bz2 dotty-3dfdb907759b6344b6c0544b5378847ebe252a71.zip |
Consolidated tracing under -YdebugTrace.
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r-- | src/dotty/tools/dotc/config/ScalaSettings.scala | 1 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Printers.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymbolLoaders.scala | 7 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparers.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeOps.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/Reporter.scala | 8 |
8 files changed, 25 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala index 1eeae8453..22e8b99c8 100644 --- a/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -106,6 +106,7 @@ class ScalaSettings extends Settings.SettingGroup { val Xdce = BooleanSetting("-Ydead-code", "Perform dead code elimination.") val debug = BooleanSetting("-Ydebug", "Increase the quantity of debugging output.") val debugNames = BooleanSetting("-YdebugNames", "Show name-space indicators when printing names") + val debugTrace = BooleanSetting("-YdebugTrace", "Trace core operations") //val doc = BooleanSetting ("-Ydoc", "Generate documentation") val termConflict = ChoiceSetting("-Yresolve-term-conflict", "strategy", "Resolve term conflicts", List("package", "object", "error"), "error") val inline = BooleanSetting("-Yinline", "Perform inlining when possible.") diff --git a/src/dotty/tools/dotc/core/Printers.scala b/src/dotty/tools/dotc/core/Printers.scala index 6e63eec3a..e789e7db1 100644 --- a/src/dotty/tools/dotc/core/Printers.scala +++ b/src/dotty/tools/dotc/core/Printers.scala @@ -96,9 +96,9 @@ object Printers { try { ctx.toTextRecursions += 1 op -// } catch { -// case ex: CyclicReference => -// s"<cycle involving ${ex.denot}>" + } catch { + case ex: CyclicReference => + s"<cycle involving ${ex.denot}>" } finally { ctx.toTextRecursions -= 1 } diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 1d806edc1..31a1509da 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -99,7 +99,7 @@ object SymDenotations { if (_flags is Touched) throw new CyclicReference(this) _flags |= Touched - Context.theBase.initialCtx.traceIndented(s"completing ${this.debugString}") { + Context.theBase.initialCtx.debugTraceIndented(s"completing ${this.debugString}") { completer.complete(this) } } @@ -893,7 +893,7 @@ object SymDenotations { NoType } - ctx.traceIndented(s"$tp.baseType($this) ${tp.typeSymbol.fullName} ${this.fullName}") { + ctx.debugTraceIndented(s"$tp.baseType($this) ${tp.typeSymbol.fullName} ${this.fullName}") { if (symbol.isStatic) symbol.typeConstructor else tp match { case tp: CachedType => diff --git a/src/dotty/tools/dotc/core/SymbolLoaders.scala b/src/dotty/tools/dotc/core/SymbolLoaders.scala index d3d99c11a..f2c3de9a7 100644 --- a/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -228,9 +228,12 @@ abstract class SymbolLoader extends LazyType { } try { val start = currentTime - cctx.traceIndented(s">>>> loading ${root.debugString}", _ => s"<<<< loaded ${root.debugString}") { + if (cctx.settings.debugTrace.value) + cctx.traceIndented(s">>>> loading ${root.debugString}", _ => s"<<<< loaded ${root.debugString}") { + doComplete(root) + } + else doComplete(root) - } cctx.informTime("loaded " + description, start) } catch { case ex: IOException => diff --git a/src/dotty/tools/dotc/core/TypeComparers.scala b/src/dotty/tools/dotc/core/TypeComparers.scala index 464cec37c..0e0f9c09d 100644 --- a/src/dotty/tools/dotc/core/TypeComparers.scala +++ b/src/dotty/tools/dotc/core/TypeComparers.scala @@ -55,7 +55,7 @@ object TypeComparers { } } - def firstTry(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"$tp1 <:< $tp2") { + def firstTry(tp1: Type, tp2: Type): Boolean = ctx.debugTraceIndented(s"$tp1 <:< $tp2") { tp2 match { case tp2: NamedType => tp1 match { diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index 7b09df769..331431fac 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -19,7 +19,7 @@ trait TypeOps { this: Context => else toPrefix(pre.baseType(cls).normalizedPrefix, cls.owner, thiscls) - ctx.traceIndented(s"$tp.asSeenFrom($pre, $cls)") { + /* ctx.debugTraceIndented(s"$tp.asSeenFrom($pre, $cls)") */ { // !!! DEBUG tp match { case tp: NamedType => val sym = tp.symbol @@ -39,6 +39,8 @@ trait TypeOps { this: Context => asSeenFrom(tp.parent, pre, cls, theMap), tp.refinedName, asSeenFrom(tp.refinedInfo, pre, cls, theMap)) + case tp: ClassInfo => + tp.derivedClassInfo(asSeenFrom(tp.prefix, pre, cls, theMap)) case _ => (if (theMap != null) theMap else new AsSeenFromMap(pre, cls)) .mapOver(tp) diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index a397426c7..c3279c34a 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1419,6 +1419,10 @@ object Types { parentsCache } + def derivedClassInfo(prefix: Type)(implicit ctx: Context) = + if (prefix eq this.prefix) this + else ClassInfo(prefix, cls, classParents, decls, optSelfType) + def derivedClassInfo(prefix: Type, classParents: List[TypeRef], optSelfType: Type)(implicit ctx: Context) = if ((prefix eq this.prefix) && (classParents eq this.classParents) && (optSelfType eq this.optSelfType)) this else ClassInfo(prefix, cls, classParents, decls, optSelfType) diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala index 9e3a11352..2c892938c 100644 --- a/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/src/dotty/tools/dotc/reporting/Reporter.scala @@ -35,6 +35,10 @@ trait Reporting { this: Context => value } + def debugTraceIndented[T](question: => String)(op: => T): T = + if (this.settings.debugTrace.value) traceIndented(question)(op) + else op + def traceIndented[T](question: => String)(op: => T): T = traceIndented[T](s"==> $question?", (res: Any) => s"<== $question = $res")(op) @@ -54,8 +58,8 @@ trait Reporting { this: Context => res } catch { case ex: Throwable => - finalize("<missing>", s" (with exception $ex)") - throw ex + finalize("<missing>", s" (with exception $ex)") + throw ex } } } |