diff options
author | Martin Odersky <odersky@gmail.com> | 2017-01-30 17:53:54 +1100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-02-08 19:35:58 +1100 |
commit | bc06d17ebfd7c8d6003dffe925c3cf9ebca6b1b9 (patch) | |
tree | a40ab611b1f005aef68d869914b353ae10441347 /compiler/src/dotty | |
parent | 269be04ce9f42d57dbc9ceb24afbae1b615e64e4 (diff) | |
download | dotty-bc06d17ebfd7c8d6003dffe925c3cf9ebca6b1b9.tar.gz dotty-bc06d17ebfd7c8d6003dffe925c3cf9ebca6b1b9.tar.bz2 dotty-bc06d17ebfd7c8d6003dffe925c3cf9ebca6b1b9.zip |
Print typerstate nesting info as part of constr printing
When printing info about adding to constraints, show the hashes
of the typerstate stack, so that we know where constraints are added.
Diffstat (limited to 'compiler/src/dotty')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala | 10 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/TyperState.scala | 6 |
2 files changed, 11 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala index 42df53fed..3aa20f15b 100644 --- a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala +++ b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala @@ -79,12 +79,12 @@ trait ConstraintHandling { if (Config.failOnInstantiationToNothing) assert(false, msg) else ctx.log(msg) } - constr.println(i"adding $description") + constr.println(i"adding $description in ${ctx.typerState.hashesStr}") val lower = constraint.lower(param) val res = addOneBound(param, bound, isUpper = true) && lower.forall(addOneBound(_, bound, isUpper = true)) - constr.println(i"added $description = $res") + constr.println(i"added $description = $res in ${ctx.typerState.hashesStr}") res } @@ -95,7 +95,7 @@ trait ConstraintHandling { val res = addOneBound(param, bound, isUpper = false) && upper.forall(addOneBound(_, bound, isUpper = false)) - constr.println(i"added $description = $res") + constr.println(i"added $description = $res in ${ctx.typerState.hashesStr}") res } @@ -108,12 +108,12 @@ trait ConstraintHandling { val up2 = p2 :: constraint.exclusiveUpper(p2, p1) val lo1 = constraint.nonParamBounds(p1).lo val hi2 = constraint.nonParamBounds(p2).hi - constr.println(i"adding $description down1 = $down1, up2 = $up2") + constr.println(i"adding $description down1 = $down1, up2 = $up2 ${ctx.typerState.hashesStr}") constraint = constraint.addLess(p1, p2) down1.forall(addOneBound(_, hi2, isUpper = true)) && up2.forall(addOneBound(_, lo1, isUpper = false)) } - constr.println(i"added $description = $res") + constr.println(i"added $description = $res ${ctx.typerState.hashesStr}") res } diff --git a/compiler/src/dotty/tools/dotc/core/TyperState.scala b/compiler/src/dotty/tools/dotc/core/TyperState.scala index 5c476c1cb..206438d86 100644 --- a/compiler/src/dotty/tools/dotc/core/TyperState.scala +++ b/compiler/src/dotty/tools/dotc/core/TyperState.scala @@ -79,6 +79,9 @@ class TyperState(r: Reporter) extends DotClass with Showable { def tryWithFallback[T](op: => T)(fallback: => T)(implicit ctx: Context): T = unsupported("tryWithFallBack") override def toText(printer: Printer): Text = "ImmutableTyperState" + + /** A string showing the hashes of all nested mutable typerstates */ + def hashesStr: String = "" } class MutableTyperState(previous: TyperState, r: Reporter, override val isCommittable: Boolean) @@ -207,4 +210,7 @@ extends TyperState(r) { } override def toText(printer: Printer): Text = constraint.toText(printer) + + override def hashesStr: String = hashCode.toString + " -> " + previous.hashesStr + } |