diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-03 14:21:33 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-03 14:21:33 +0100 |
commit | fd5e45bd71c972fddc0f835cdb011beb76a77770 (patch) | |
tree | 619ca441a99605f228add3667ae18d04d463d626 /src/dotty/tools/dotc/core/TypeComparer.scala | |
parent | 2d500b7746a38647c7a97db99207ca4972cd49eb (diff) | |
download | dotty-fd5e45bd71c972fddc0f835cdb011beb76a77770.tar.gz dotty-fd5e45bd71c972fddc0f835cdb011beb76a77770.tar.bz2 dotty-fd5e45bd71c972fddc0f835cdb011beb76a77770.zip |
Making printing configurable.
Special by-topic printers that can be turned off.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 28 |
1 files changed, 14 insertions, 14 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 } |