@@ -166,14 +166,18 @@ object Inferencing {
166166
167167 private var toMaximize : List [TypeVar ] = Nil
168168
169- def apply (x : Boolean , tp : Type ): Boolean =
170- try tp.dealias match
169+ def apply (x : Boolean , tp : Type ): Boolean = trace(i " isFullyDefined( $tp, $force) " , typr) {
170+ try {
171+ val tpd = tp.dealias
172+ if tpd ne tp then apply(x, tpd)
173+ else tp match
171174 case _ : WildcardType | _ : ProtoType =>
172175 false
173176 case tvar : TypeVar if ! tvar.isInstantiated =>
174177 force.appliesTo(tvar)
175178 && ctx.typerState.constraint.contains(tvar)
176179 && {
180+ var fail = false
177181 val direction = instDirection(tvar.origin)
178182 if minimizeSelected then
179183 if direction <= 0 && tvar.hasLowerBound then
@@ -186,17 +190,16 @@ object Inferencing {
186190 else if variance >= 0 && (force.ifBottom == IfBottom .ok && ! tvar.hasUpperBound || tvar.hasLowerBound) then
187191 instantiate(tvar, fromBelow = true )
188192 else if variance >= 0 && force.ifBottom == IfBottom .fail then
189- return false
193+ fail = true
190194 else
191195 toMaximize = tvar :: toMaximize
192- foldOver(x, tvar)
193- }
194- case tp =>
195- reporting.trace(s " IFT $tp" ) {
196- foldOver(x, tp)
196+ ! fail && foldOver(x, tvar)
197197 }
198+ case tp => foldOver(x, tp)
199+ }
198200 catch case ex : Throwable =>
199201 handleRecursive(" check fully defined" , tp.show, ex)
202+ }
200203
201204 def process (tp : Type ): Boolean =
202205 // Maximize type vars in the order they were visited before */
@@ -767,13 +770,14 @@ trait Inferencing { this: Typer =>
767770 end constrainIfDependentParamRef
768771}
769772
770- /** An enumeration controlling the degree of forcing in "is-dully -defined" checks. */
773+ /** An enumeration controlling the degree of forcing in "is-fully -defined" checks. */
771774@ sharable object ForceDegree {
772- class Value (val appliesTo : TypeVar => Boolean , val ifBottom : IfBottom )
773- val none : Value = new Value (_ => false , IfBottom .ok)
774- val all : Value = new Value (_ => true , IfBottom .ok)
775- val failBottom : Value = new Value (_ => true , IfBottom .fail)
776- val flipBottom : Value = new Value (_ => true , IfBottom .flip)
775+ class Value (val appliesTo : TypeVar => Boolean , val ifBottom : IfBottom ):
776+ override def toString = s " ForceDegree.Value(.., $ifBottom) "
777+ val none : Value = new Value (_ => false , IfBottom .ok) { override def toString = " ForceDegree.none" }
778+ val all : Value = new Value (_ => true , IfBottom .ok) { override def toString = " ForceDegree.all" }
779+ val failBottom : Value = new Value (_ => true , IfBottom .fail) { override def toString = " ForceDegree.failBottom" }
780+ val flipBottom : Value = new Value (_ => true , IfBottom .flip) { override def toString = " ForceDegree.flipBottom" }
777781}
778782
779783enum IfBottom :
0 commit comments