@@ -170,14 +170,18 @@ object Inferencing {
170
170
171
171
private var toMaximize : List [TypeVar ] = Nil
172
172
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
175
178
case _ : WildcardType | _ : ProtoType =>
176
179
false
177
180
case tvar : TypeVar if ! tvar.isInstantiated =>
178
181
force.appliesTo(tvar)
179
182
&& ctx.typerState.constraint.contains(tvar)
180
183
&& {
184
+ var fail = false
181
185
val direction = instDirection(tvar.origin)
182
186
if minimizeSelected then
183
187
if direction <= 0 && tvar.hasLowerBound then
@@ -190,17 +194,16 @@ object Inferencing {
190
194
else if variance >= 0 && (force.ifBottom == IfBottom .ok || tvar.hasLowerBound) then
191
195
instantiate(tvar, fromBelow = true )
192
196
else if variance >= 0 && force.ifBottom == IfBottom .fail then
193
- return false
197
+ fail = true
194
198
else
195
199
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)
201
201
}
202
+ case tp => foldOver(x, tp)
203
+ }
202
204
catch case ex : Throwable =>
203
205
handleRecursive(" check fully defined" , tp.show, ex)
206
+ }
204
207
205
208
def process (tp : Type ): Boolean =
206
209
// 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