@@ -612,7 +612,7 @@ class Typer extends Namer
612
612
var templ1 = templ
613
613
def isEligible (tp : Type ) = tp.exists && ! tp.typeSymbol.is(Final ) && ! tp.isRef(defn.AnyClass )
614
614
if (templ1.parents.isEmpty &&
615
- isFullyDefined(pt, ForceDegree .noBottom ) &&
615
+ isFullyDefined(pt, ForceDegree .flipBottom ) &&
616
616
isSkolemFree(pt) &&
617
617
isEligible(pt.underlyingClassRef(refinementOK = false )))
618
618
templ1 = cpy.Template (templ)(parents = untpd.TypeTree (pt) :: Nil )
@@ -1034,7 +1034,7 @@ class Typer extends Namer
1034
1034
// try to instantiate `pt` if this is possible. If it does not
1035
1035
// work the error will be reported later in `inferredParam`,
1036
1036
// when we try to infer the parameter type.
1037
- isFullyDefined(pt, ForceDegree .noBottom )
1037
+ isFullyDefined(pt, ForceDegree .flipBottom )
1038
1038
case _ =>
1039
1039
}
1040
1040
@@ -1049,17 +1049,18 @@ class Typer extends Namer
1049
1049
*
1050
1050
* The inference makes three attempts:
1051
1051
*
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.
1053
1054
* 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 ,
1055
1056
* 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 ,
1057
1058
* pick this one.
1058
1059
*
1059
1060
* If all attempts fail, issue a "missing parameter type" error.
1060
1061
*/
1061
1062
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
1063
1064
val target = calleeType.widen match
1064
1065
case mtpe : MethodType =>
1065
1066
val pos = paramIndex(param.name)
@@ -1069,8 +1070,8 @@ class Typer extends Namer
1069
1070
else NoType
1070
1071
case _ => NoType
1071
1072
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
1074
1075
else errorType(AnonymousFunctionMissingParamType (param, params, tree, formal), param.sourcePos)
1075
1076
1076
1077
def protoFormal (i : Int ): Type =
@@ -1079,7 +1080,7 @@ class Typer extends Namer
1079
1080
1080
1081
/** Is `formal` a product type which is elementwise compatible with `params`? */
1081
1082
def ptIsCorrectProduct (formal : Type ) =
1082
- isFullyDefined(formal, ForceDegree .noBottom ) &&
1083
+ isFullyDefined(formal, ForceDegree .flipBottom ) &&
1083
1084
(defn.isProductSubType(formal) || formal.derivesFrom(defn.PairClass )) &&
1084
1085
productSelectorTypes(formal, tree.sourcePos).corresponds(params) {
1085
1086
(argType, param) =>
@@ -1393,7 +1394,7 @@ class Typer extends Namer
1393
1394
}
1394
1395
case _ =>
1395
1396
tree.withType(
1396
- if (isFullyDefined(pt, ForceDegree .noBottom )) pt
1397
+ if (isFullyDefined(pt, ForceDegree .flipBottom )) pt
1397
1398
else if (ctx.reporter.errorsReported) UnspecifiedErrorType
1398
1399
else errorType(i " cannot infer type; expected type $pt is not fully defined " , tree.sourcePos))
1399
1400
}
@@ -3068,7 +3069,7 @@ class Typer extends Namer
3068
3069
pt match {
3069
3070
case SAMType (sam)
3070
3071
if wtp <:< sam.toFunctionType() =>
3071
- // was ... && isFullyDefined(pt, ForceDegree.noBottom )
3072
+ // was ... && isFullyDefined(pt, ForceDegree.flipBottom )
3072
3073
// but this prevents case blocks from implementing polymorphic partial functions,
3073
3074
// since we do not know the result parameter a priori. Have to wait until the
3074
3075
// body is typechecked.
0 commit comments