@@ -170,14 +170,18 @@ object Inferencing {
170170
171171 private var toMaximize : List [TypeVar ] = Nil
172172
173- def apply (x : Boolean , tp : Type ): Boolean =
174- try tp.dealias match
173+ def apply (x : Boolean , tp : Type ): Boolean = trace(i " isFullyDefined( $tp, $force) " , typr) {
174+ try {
175+ val tpd = tp.dealias
176+ if tpd ne tp then apply(x, tpd)
177+ else tp match
175178 case _ : WildcardType | _ : ProtoType =>
176179 false
177180 case tvar : TypeVar if ! tvar.isInstantiated =>
178181 force.appliesTo(tvar)
179182 && ctx.typerState.constraint.contains(tvar)
180183 && {
184+ var fail = false
181185 val direction = instDirection(tvar.origin)
182186 if minimizeSelected then
183187 if direction <= 0 && tvar.hasLowerBound then
@@ -190,17 +194,16 @@ object Inferencing {
190194 else if variance >= 0 && (force.ifBottom == IfBottom .ok || tvar.hasLowerBound) then
191195 instantiate(tvar, fromBelow = true )
192196 else if variance >= 0 && force.ifBottom == IfBottom .fail then
193- return false
197+ fail = true
194198 else
195199 toMaximize = tvar :: toMaximize
196- foldOver(x, tvar)
197- }
198- case tp =>
199- reporting.trace(s " IFT $tp" ) {
200- foldOver(x, tp)
200+ ! fail && foldOver(x, tvar)
201201 }
202+ case tp => foldOver(x, tp)
203+ }
202204 catch case ex : Throwable =>
203205 handleRecursive(" check fully defined" , tp.show, ex)
206+ }
204207
205208 def process (tp : Type ): Boolean =
206209 // 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