@@ -20,6 +20,9 @@ import config.Printers.{constr, typr}
2020 */
2121trait ConstraintHandling {
2222
23+ def constr_println (msg : => String ): Unit = constr.println(msg)
24+ def typr_println (msg : => String ): Unit = typr.println(msg)
25+
2326 implicit val ctx : Context
2427
2528 protected def isSubType (tp1 : Type , tp2 : Type ): Boolean
@@ -120,23 +123,23 @@ trait ConstraintHandling {
120123 if (Config .failOnInstantiationToNothing) assert(false , msg)
121124 else ctx.log(msg)
122125 }
123- constr.println (i " adding $description$location" )
126+ constr_println (i " adding $description$location" )
124127 val lower = constraint.lower(param)
125128 val res =
126129 addOneBound(param, bound, isUpper = true ) &&
127130 lower.forall(addOneBound(_, bound, isUpper = true ))
128- constr.println (i " added $description = $res$location" )
131+ constr_println (i " added $description = $res$location" )
129132 res
130133 }
131134
132135 protected def addLowerBound (param : TypeParamRef , bound : Type ): Boolean = {
133136 def description = i " constraint $param >: $bound to \n $constraint"
134- constr.println (i " adding $description" )
137+ constr_println (i " adding $description" )
135138 val upper = constraint.upper(param)
136139 val res =
137140 addOneBound(param, bound, isUpper = false ) &&
138141 upper.forall(addOneBound(_, bound, isUpper = false ))
139- constr.println (i " added $description = $res$location" )
142+ constr_println (i " added $description = $res$location" )
140143 res
141144 }
142145
@@ -149,20 +152,20 @@ trait ConstraintHandling {
149152 val up2 = p2 :: constraint.exclusiveUpper(p2, p1)
150153 val lo1 = constraint.nonParamBounds(p1).lo
151154 val hi2 = constraint.nonParamBounds(p2).hi
152- constr.println (i " adding $description down1 = $down1, up2 = $up2$location" )
155+ constr_println (i " adding $description down1 = $down1, up2 = $up2$location" )
153156 constraint = constraint.addLess(p1, p2)
154157 down1.forall(addOneBound(_, hi2, isUpper = true )) &&
155158 up2.forall(addOneBound(_, lo1, isUpper = false ))
156159 }
157- constr.println (i " added $description = $res$location" )
160+ constr_println (i " added $description = $res$location" )
158161 res
159162 }
160163
161164 /** Make p2 = p1, transfer all bounds of p2 to p1
162165 * @pre less(p1)(p2)
163166 */
164167 private def unify (p1 : TypeParamRef , p2 : TypeParamRef ): Boolean = {
165- constr.println (s " unifying $p1 $p2" )
168+ constr_println (s " unifying $p1 $p2" )
166169 assert(constraint.isLess(p1, p2))
167170 val down = constraint.exclusiveLower(p2, p1)
168171 val up = constraint.exclusiveUpper(p1, p2)
@@ -260,7 +263,7 @@ trait ConstraintHandling {
260263 case _ : TypeBounds =>
261264 val bound = if (fromBelow) constraint.fullLowerBound(param) else constraint.fullUpperBound(param)
262265 val inst = avoidParam(bound)
263- typr.println (s " approx ${param.show}, from below = $fromBelow, bound = ${bound.show}, inst = ${inst.show}" )
266+ typr_println (s " approx ${param.show}, from below = $fromBelow, bound = ${bound.show}, inst = ${inst.show}" )
264267 inst
265268 case inst =>
266269 assert(inst.exists, i " param = $param\n constraint = $constraint" )
@@ -359,7 +362,7 @@ trait ConstraintHandling {
359362 val lower = constraint.lower(param)
360363 val upper = constraint.upper(param)
361364 if (lower.nonEmpty && ! bounds.lo.isRef(defn.NothingClass ) ||
362- upper.nonEmpty && ! bounds.hi.isRef(defn.AnyClass )) constr.println (i " INIT*** $tl" )
365+ upper.nonEmpty && ! bounds.hi.isRef(defn.AnyClass )) constr_println (i " INIT*** $tl" )
363366 lower.forall(addOneBound(_, bounds.hi, isUpper = true )) &&
364367 upper.forall(addOneBound(_, bounds.lo, isUpper = false ))
365368 case _ =>
0 commit comments