@@ -46,7 +46,7 @@ object Inferencing {
46
46
47
47
/** Instantiate selected type variables `tvars` in type `tp` */
48
48
def instantiateSelected (tp : Type , tvars : List [Type ])(implicit ctx : Context ): Unit =
49
- new IsFullyDefinedAccumulator (new ForceDegree .Value (tvars.contains)).process(tp)
49
+ new IsFullyDefinedAccumulator (new ForceDegree .Value (tvars.contains, minimizeAll = true )).process(tp)
50
50
51
51
/** The accumulator which forces type variables using the policy encoded in `force`
52
52
* and returns whether the type is fully defined. The direction in which
@@ -81,11 +81,12 @@ object Inferencing {
81
81
force.appliesTo(tvar) && {
82
82
val direction = instDirection(tvar.origin)
83
83
if (direction != 0 ) {
84
- // if (direction > 0) println(s"inst $tvar dir = up")
84
+ if (direction > 0 ) println(s " inst $tvar dir = up " )
85
85
instantiate(tvar, direction < 0 )
86
86
}
87
87
else {
88
88
val minimize =
89
+ force.minimizeAll ||
89
90
variance >= 0 && ! (
90
91
force == ForceDegree .noBottom &&
91
92
defn.isBottomType(ctx.typeComparer.approximation(tvar.origin, fromBelow = true )))
@@ -293,9 +294,9 @@ object Inferencing {
293
294
294
295
/** An enumeration controlling the degree of forcing in "is-dully-defined" checks. */
295
296
@ sharable object ForceDegree {
296
- class Value (val appliesTo : TypeVar => Boolean )
297
- val none = new Value (_ => false )
298
- val all = new Value (_ => true )
299
- val noBottom = new Value (_ => true )
297
+ class Value (val appliesTo : TypeVar => Boolean , val minimizeAll : Boolean )
298
+ val none = new Value (_ => false , minimizeAll = false )
299
+ val all = new Value (_ => true , minimizeAll = false )
300
+ val noBottom = new Value (_ => true , minimizeAll = false )
300
301
}
301
302
0 commit comments