@@ -482,7 +482,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
482482 }
483483 else if (cls2.is(JavaDefined )) {
484484 // 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)
486486 if (base.typeSymbol == cls2) return true
487487 }
488488 else if (tp1.isLambdaSub && ! tp1.isRef(AnyKindClass ))
@@ -706,7 +706,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
706706 }
707707
708708 def tryBaseType (cls2 : Symbol ) = {
709- val base = tp1.baseType( cls2)
709+ val base = nonExprBaseType(tp1, cls2)
710710 if (base.exists && (base `ne` tp1))
711711 isSubType(base, tp2, if (tp1.isRef(cls2)) approx else approx.addLow) ||
712712 base.isInstanceOf [OrType ] && fourthTry
@@ -930,8 +930,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
930930 val classBounds = tycon2.classSymbols
931931 def liftToBase (bcs : List [ClassSymbol ]): Boolean = bcs match {
932932 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)
935935 case _ =>
936936 false
937937 }
@@ -1107,6 +1107,10 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
11071107 }
11081108 }
11091109
1110+ private def nonExprBaseType (tp : Type , cls : Symbol )(given Context ): Type =
1111+ if tp.isInstanceOf [ExprType ] then NoType
1112+ else tp.baseType(cls)
1113+
11101114 /** If `tp` is an external reference to an enclosing module M that contains opaque types,
11111115 * convert to M.this.
11121116 * 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
12831287 case bc :: bcs1 =>
12841288 (classBounds.exists(bc.derivesFrom) &&
12851289 variancesConform(bc.typeParams, tparams) &&
1286- p(tp1.baseType( bc))
1290+ p(nonExprBaseType(tp1, bc))
12871291 ||
12881292 recur(bcs1))
12891293 case nil =>
0 commit comments