summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-08-17 09:20:47 -0700
committerPaul Phillips <paulp@improving.org>2013-08-17 10:58:14 -0700
commit8c94e9cefce1a4c7f8d35c566770aab6908c993d (patch)
tree95a8382b32eb5473aac51910c46e79e365e8bfdd
parenta2189f48084b71a25725fedb7808aba2e71715ad (diff)
downloadscala-8c94e9cefce1a4c7f8d35c566770aab6908c993d.tar.gz
scala-8c94e9cefce1a4c7f8d35c566770aab6908c993d.tar.bz2
scala-8c94e9cefce1a4c7f8d35c566770aab6908c993d.zip
Add some logging to instantiateTypeVar.
This method is right at the center of ALL KINDS of bad. "this is quite nasty" begins the comment, and I credit its deadpan understatement. A little logging is the least we can offer the next guy.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index c8377fde95..a7c43361fa 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -1199,6 +1199,17 @@ trait Infer extends Checkable {
val tparam = tvar.origin.typeSymbol
val TypeBounds(lo0, hi0) = tparam.info.bounds
val tb @ TypeBounds(lo1, hi1) = instBounds(tvar)
+ val enclCase = context.enclosingCaseDef
+
+ log("\n" + sm"""
+ |-----
+ | enclCase: ${enclCase.tree}
+ | saved: ${enclCase.savedTypeBounds}
+ | tparam: ${tparam.shortSymbolClass}
+ | def_s: ${tparam.defString}
+ | seen_s: ${tparam.defStringSeenAs(tb)}
+ |-----
+ """.trim)
if (lo1 <:< hi1) {
if (lo1 <:< lo0 && hi0 <:< hi1) // bounds unimproved
@@ -1206,7 +1217,7 @@ trait Infer extends Checkable {
else if (tparam == lo1.typeSymbolDirect || tparam == hi1.typeSymbolDirect)
log(s"cyclical bounds: discarding TypeBounds($lo1, $hi1) for $tparam because $tparam appears as bounds")
else {
- context.enclosingCaseDef pushTypeBounds tparam
+ enclCase pushTypeBounds tparam
tparam setInfo logResult(s"updated bounds: $tparam from ${tparam.info} to")(tb)
}
}