@@ -612,7 +612,7 @@ class Typer extends Namer
612612 var templ1 = templ
613613 def isEligible (tp : Type ) = tp.exists && ! tp.typeSymbol.is(Final ) && ! tp.isRef(defn.AnyClass )
614614 if (templ1.parents.isEmpty &&
615- isFullyDefined(pt, ForceDegree .noBottom ) &&
615+ isFullyDefined(pt, ForceDegree .flipBottom ) &&
616616 isSkolemFree(pt) &&
617617 isEligible(pt.underlyingClassRef(refinementOK = false )))
618618 templ1 = cpy.Template (templ)(parents = untpd.TypeTree (pt) :: Nil )
@@ -1034,7 +1034,7 @@ class Typer extends Namer
10341034 // try to instantiate `pt` if this is possible. If it does not
10351035 // work the error will be reported later in `inferredParam`,
10361036 // when we try to infer the parameter type.
1037- isFullyDefined(pt, ForceDegree .noBottom )
1037+ isFullyDefined(pt, ForceDegree .flipBottom )
10381038 case _ =>
10391039 }
10401040
@@ -1049,17 +1049,18 @@ class Typer extends Namer
10491049 *
10501050 * The inference makes three attempts:
10511051 *
1052- * 1. If the expected type `S` is already fully defined pick this one.
1052+ * 1. If the expected type `S` is already fully defined under ForceDegree.failBottom
1053+ * pick this one.
10531054 * 2. Compute the target type `T` and make it known that `S <: T`.
1054- * If the expected type `S` can be fully defined under ForceDegree.noBottom ,
1055+ * If the expected type `S` can be fully defined under ForceDegree.flipBottom ,
10551056 * pick this one (this might use the fact that S <: T for an upper approximation).
1056- * 3. Otherwise, if the target type `T` can be fully defined under ForceDegree.noBottom ,
1057+ * 3. Otherwise, if the target type `T` can be fully defined under ForceDegree.flipBottom ,
10571058 * pick this one.
10581059 *
10591060 * If all attempts fail, issue a "missing parameter type" error.
10601061 */
10611062 def inferredParamType (param : untpd.ValDef , formal : Type ): Type =
1062- if isFullyDefined(formal, ForceDegree .none ) then return formal
1063+ if isFullyDefined(formal, ForceDegree .failBottom ) then return formal
10631064 val target = calleeType.widen match
10641065 case mtpe : MethodType =>
10651066 val pos = paramIndex(param.name)
@@ -1069,8 +1070,8 @@ class Typer extends Namer
10691070 else NoType
10701071 case _ => NoType
10711072 if target.exists then formal <:< target
1072- if isFullyDefined(formal, ForceDegree .noBottom ) then formal
1073- else if target.exists && isFullyDefined(target, ForceDegree .noBottom ) then target
1073+ if isFullyDefined(formal, ForceDegree .flipBottom ) then formal
1074+ else if target.exists && isFullyDefined(target, ForceDegree .flipBottom ) then target
10741075 else errorType(AnonymousFunctionMissingParamType (param, params, tree, formal), param.sourcePos)
10751076
10761077 def protoFormal (i : Int ): Type =
@@ -1079,7 +1080,7 @@ class Typer extends Namer
10791080
10801081 /** Is `formal` a product type which is elementwise compatible with `params`? */
10811082 def ptIsCorrectProduct (formal : Type ) =
1082- isFullyDefined(formal, ForceDegree .noBottom ) &&
1083+ isFullyDefined(formal, ForceDegree .flipBottom ) &&
10831084 (defn.isProductSubType(formal) || formal.derivesFrom(defn.PairClass )) &&
10841085 productSelectorTypes(formal, tree.sourcePos).corresponds(params) {
10851086 (argType, param) =>
@@ -1393,7 +1394,7 @@ class Typer extends Namer
13931394 }
13941395 case _ =>
13951396 tree.withType(
1396- if (isFullyDefined(pt, ForceDegree .noBottom )) pt
1397+ if (isFullyDefined(pt, ForceDegree .flipBottom )) pt
13971398 else if (ctx.reporter.errorsReported) UnspecifiedErrorType
13981399 else errorType(i " cannot infer type; expected type $pt is not fully defined " , tree.sourcePos))
13991400 }
@@ -3068,7 +3069,7 @@ class Typer extends Namer
30683069 pt match {
30693070 case SAMType (sam)
30703071 if wtp <:< sam.toFunctionType() =>
3071- // was ... && isFullyDefined(pt, ForceDegree.noBottom )
3072+ // was ... && isFullyDefined(pt, ForceDegree.flipBottom )
30723073 // but this prevents case blocks from implementing polymorphic partial functions,
30733074 // since we do not know the result parameter a priori. Have to wait until the
30743075 // body is typechecked.
0 commit comments