@@ -482,7 +482,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
482
482
}
483
483
else if (cls2.is(JavaDefined )) {
484
484
// If `cls2` is parameterized, we are seeing a raw type, so we need to compare only the symbol
485
- val base = tp1.baseType( cls2)
485
+ val base = nonExprBaseType(tp1, cls2)
486
486
if (base.typeSymbol == cls2) return true
487
487
}
488
488
else if (tp1.isLambdaSub && ! tp1.isRef(AnyKindClass ))
@@ -706,7 +706,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
706
706
}
707
707
708
708
def tryBaseType (cls2 : Symbol ) = {
709
- val base = tp1.baseType( cls2)
709
+ val base = nonExprBaseType(tp1, cls2)
710
710
if (base.exists && (base `ne` tp1))
711
711
isSubType(base, tp2, if (tp1.isRef(cls2)) approx else approx.addLow) ||
712
712
base.isInstanceOf [OrType ] && fourthTry
@@ -930,8 +930,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
930
930
val classBounds = tycon2.classSymbols
931
931
def liftToBase (bcs : List [ClassSymbol ]): Boolean = bcs match {
932
932
case bc :: bcs1 =>
933
- classBounds.exists(bc.derivesFrom) && appOK(tp1w.baseType( bc)) ||
934
- liftToBase(bcs1)
933
+ classBounds.exists(bc.derivesFrom) && appOK(nonExprBaseType(tp1, bc))
934
+ || liftToBase(bcs1)
935
935
case _ =>
936
936
false
937
937
}
@@ -1107,6 +1107,10 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
1107
1107
}
1108
1108
}
1109
1109
1110
+ private def nonExprBaseType (tp : Type , cls : Symbol )(given Context ): Type =
1111
+ if tp.isInstanceOf [ExprType ] then NoType
1112
+ else tp.baseType(cls)
1113
+
1110
1114
/** If `tp` is an external reference to an enclosing module M that contains opaque types,
1111
1115
* convert to M.this.
1112
1116
* Note: It would be legal to do the lifting also if M does not contain opaque types,
@@ -1283,7 +1287,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
1283
1287
case bc :: bcs1 =>
1284
1288
(classBounds.exists(bc.derivesFrom) &&
1285
1289
variancesConform(bc.typeParams, tparams) &&
1286
- p(tp1.baseType( bc))
1290
+ p(nonExprBaseType(tp1, bc))
1287
1291
||
1288
1292
recur(bcs1))
1289
1293
case nil =>
0 commit comments