@@ -166,14 +166,18 @@ object Inferencing {
166
166
167
167
private var toMaximize : List [TypeVar ] = Nil
168
168
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
171
174
case _ : WildcardType | _ : ProtoType =>
172
175
false
173
176
case tvar : TypeVar if ! tvar.isInstantiated =>
174
177
force.appliesTo(tvar)
175
178
&& ctx.typerState.constraint.contains(tvar)
176
179
&& {
180
+ var fail = false
177
181
val direction = instDirection(tvar.origin)
178
182
if minimizeSelected then
179
183
if direction <= 0 && tvar.hasLowerBound then
@@ -186,17 +190,16 @@ object Inferencing {
186
190
else if variance >= 0 && (force.ifBottom == IfBottom .ok && ! tvar.hasUpperBound || tvar.hasLowerBound) then
187
191
instantiate(tvar, fromBelow = true )
188
192
else if variance >= 0 && force.ifBottom == IfBottom .fail then
189
- return false
193
+ fail = true
190
194
else
191
195
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)
197
197
}
198
+ case tp => foldOver(x, tp)
199
+ }
198
200
catch case ex : Throwable =>
199
201
handleRecursive(" check fully defined" , tp.show, ex)
202
+ }
200
203
201
204
def process (tp : Type ): Boolean =
202
205
// Maximize type vars in the order they were visited before */
@@ -767,13 +770,14 @@ trait Inferencing { this: Typer =>
767
770
end constrainIfDependentParamRef
768
771
}
769
772
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. */
771
774
@ 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" }
777
781
}
778
782
779
783
enum IfBottom :
0 commit comments