@@ -1255,7 +1255,7 @@ class Typer extends Namer
1255
1255
// The resulting class `class $anon extends C[?] {...}` would be illegal,
1256
1256
// since type arguments to `C`'s super constructor cannot be constructed.
1257
1257
def isWildcardClassSAM =
1258
- ! pt.classSymbol.is(Trait ) && pt.argInfos.exists(_.isInstanceOf [TypeBounds ])
1258
+ ! pt.widen. classSymbol.is(Trait ) && pt.argInfos.exists(_.isInstanceOf [TypeBounds ])
1259
1259
val targetTpe =
1260
1260
if isFullyDefined(pt, ForceDegree .all) && ! isWildcardClassSAM then
1261
1261
pt
@@ -1265,9 +1265,9 @@ class Typer extends Namer
1265
1265
else
1266
1266
report.error(ex " result type of lambda is an underspecified SAM type $pt" , tree.srcPos)
1267
1267
pt
1268
- if (pt.classSymbol.isOneOf(FinalOrSealed )) {
1269
- val offendingFlag = pt.classSymbol.flags & FinalOrSealed
1270
- report.error(ex " lambda cannot implement $offendingFlag ${pt.classSymbol}" , tree.srcPos)
1268
+ if (pt.widen. classSymbol.isOneOf(FinalOrSealed )) {
1269
+ val offendingFlag = pt.widen. classSymbol.flags & FinalOrSealed
1270
+ report.error(ex " lambda cannot implement $offendingFlag ${pt.widen. classSymbol}" , tree.srcPos)
1271
1271
}
1272
1272
TypeTree (targetTpe)
1273
1273
case _ =>
@@ -2190,11 +2190,11 @@ class Typer extends Namer
2190
2190
case nil => defn.ObjectClass
2191
2191
}
2192
2192
def improve (candidate : ClassSymbol , parent : Type ): ClassSymbol = {
2193
- val pcls = realClassParent(parent.classSymbol)
2193
+ val pcls = realClassParent(parent.widen. classSymbol)
2194
2194
if (pcls derivesFrom candidate) pcls else candidate
2195
2195
}
2196
2196
parents match {
2197
- case p :: _ if p.classSymbol.isRealClass => parents
2197
+ case p :: _ if p.widen. classSymbol.isRealClass => parents
2198
2198
case _ =>
2199
2199
val pcls = parents.foldLeft(defn.ObjectClass )(improve)
2200
2200
typr.println(i " ensure first is class $parents%, % --> ${parents map (_ baseType pcls)}%, % " )
@@ -2205,7 +2205,7 @@ class Typer extends Namer
2205
2205
2206
2206
/** Ensure that first parent tree refers to a real class. */
2207
2207
def ensureFirstTreeIsClass (parents : List [Tree ], span : Span )(using Context ): List [Tree ] = parents match {
2208
- case p :: ps if p.tpe.classSymbol.isRealClass => parents
2208
+ case p :: ps if p.tpe.widen. classSymbol.isRealClass => parents
2209
2209
case _ => TypeTree (ensureFirstIsClass(parents.tpes, span).head).withSpan(span.focus) :: parents
2210
2210
}
2211
2211
@@ -3207,7 +3207,7 @@ class Typer extends Namer
3207
3207
! (isSyntheticApply(tree) && ! isExpandableApply)) {
3208
3208
if (! defn.isFunctionType(pt))
3209
3209
pt match {
3210
- case SAMType (_) if ! pt.classSymbol.hasAnnotation(defn.FunctionalInterfaceAnnot ) =>
3210
+ case SAMType (_) if ! pt.widen. classSymbol.hasAnnotation(defn.FunctionalInterfaceAnnot ) =>
3211
3211
report.warning(ex " ${tree.symbol} is eta-expanded even though $pt does not have the @FunctionalInterface annotation. " , tree.srcPos)
3212
3212
case _ =>
3213
3213
}
@@ -3226,7 +3226,7 @@ class Typer extends Namer
3226
3226
isContextFunctionRef(parent) // apply refinements indicate a dependent CFT
3227
3227
case _ =>
3228
3228
val underlying = wtp.underlyingClassRef(refinementOK = false ) // other refinements are not OK
3229
- defn.isContextFunctionClass(underlying.classSymbol)
3229
+ defn.isContextFunctionClass(underlying.widen. classSymbol)
3230
3230
}
3231
3231
3232
3232
def adaptNoArgsOther (wtp : Type ): Tree = {
0 commit comments