aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala28
-rw-r--r--src/dotty/tools/dotc/core/Types.scala3
2 files changed, 16 insertions, 15 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 0d3bf2e94..582fa7b21 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -9,6 +9,7 @@ import collection.mutable
import printing.Disambiguation.disambiguated
import util.SimpleMap
import config.Config
+import config.Printers._
/** Provides methods to compare types.
*/
@@ -62,18 +63,17 @@ class TypeComparer(initctx: Context) extends DotClass {
if (fromBelow) oldBounds.derivedTypeBounds(oldBounds.lo | bound, oldBounds.hi)
else oldBounds.derivedTypeBounds(oldBounds.lo, oldBounds.hi & bound)
finally ignoreConstraint = saved
- // val res = // !!!DEBUG
- (param == bound) ||
- (oldBounds eq newBounds) || {
- val saved = constraint
- constraint = constraint.updated(param, newBounds)
- isSubType(newBounds.lo, newBounds.hi) ||
- { constraint = saved; false } // don't leave the constraint in unsatisfiable state
- }
- //println(s"add constraint $param ${if (fromBelow) ">:" else "<:"} $bound = $res")
- //if (res)
- // println(constraint.show)
- //res
+ val res =
+ (param == bound) ||
+ (oldBounds eq newBounds) || {
+ val saved = constraint
+ constraint = constraint.updated(param, newBounds)
+ isSubType(newBounds.lo, newBounds.hi) ||
+ { constraint = saved; false } // don't leave the constraint in unsatisfiable state
+ }
+ constr.println(s"add constraint $param ${if (fromBelow) ">:" else "<:"} $bound = $res")
+ if (res) constr.println(constraint.show)
+ res
}
/** If current constraint set is not frozen, add the constraint
@@ -89,7 +89,7 @@ class TypeComparer(initctx: Context) extends DotClass {
def addConstraint(param: PolyParam, bound: Type, fromBelow: Boolean): Boolean = {
param == bound ||
!frozenConstraint && {
- // println(s"adding ${param.show} ${if (fromBelow) ">:>" else "<:<"} ${bound.show} to ${constraint.show}")
+ constr.println(s"adding ${param.show} ${if (fromBelow) ">:>" else "<:<"} ${bound.show} to ${constraint.show}")
bound match {
case bound: PolyParam if constraint contains bound =>
addConstraint1(param, bound, fromBelow) &&
@@ -121,7 +121,7 @@ class TypeComparer(initctx: Context) extends DotClass {
val bounds = constraint.bounds(param)
val bound = if (fromBelow) bounds.lo else bounds.hi
val inst = avoidParam(bound)
- println(s"approx ${param.show}, from below = $fromBelow, bound = ${bound.show}, inst = ${inst.show}")
+ typr.println(s"approx ${param.show}, from below = $fromBelow, bound = ${bound.show}, inst = ${inst.show}")
inst
}
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index afe531d4e..a3639cbde 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -25,6 +25,7 @@ import printing.Printer
import scala.util.hashing.{ MurmurHash3 => hashing }
import collection.{mutable, Seq, breakOut}
import config.Config
+import config.Printers._
import language.implicitConversions
object Types {
@@ -1708,7 +1709,7 @@ object Types {
/** Instantiate variable with given type */
def instantiateWith(tp: Type)(implicit ctx: Context): Type = {
assert(tp ne this)
- println(s"instantiating ${this.show} with ${tp.show}") // !!!DEBUG
+ typr.println(s"instantiating ${this.show} with ${tp.show}")
assert(ctx.typerState.constraint contains this) // !!! DEBUG
if (ctx.typerState eq owningState) inst = tp
ctx.typerState.constraint = ctx.typerState.constraint.replace(origin, tp)