Skip to content

Commit 314567a

Browse files
committed
Simplify and fix widenAbstractTypes
1 parent 911d4f1 commit 314567a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

+9-9
Original file line numberDiff line numberDiff line change
@@ -2312,18 +2312,18 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
23122312
case _ =>
23132313
cas
23142314
}
2315-
def widenAbstractTypes(tp: Type): Type = new TypeMap {
2316-
def apply(tp: Type) = tp match {
2315+
def widenAbstractTypes(tp: Type) = new TypeMap {
2316+
def apply(tp: Type): Type = tp match {
23172317
case tp: TypeRef =>
2318-
if (tp.symbol.isAbstractOrParamType | tp.symbol.isOpaqueAlias)
2319-
WildcardType
2320-
else tp.info match {
2321-
case TypeAlias(alias) =>
2322-
val alias1 = widenAbstractTypes(alias)
2323-
if (alias1 ne alias) alias1 else tp
2318+
tp.info match {
2319+
case TypeBounds(lo, hi) =>
2320+
if (hi frozen_<:< lo) {
2321+
val alias = apply(lo)
2322+
if (alias ne lo) alias else mapOver(tp)
2323+
}
2324+
else WildcardType
23242325
case _ => mapOver(tp)
23252326
}
2326-
23272327
case tp: TypeVar if !tp.isInstantiated => WildcardType
23282328
case _: TypeParamRef => WildcardType
23292329
case _ => mapOver(tp)

0 commit comments

Comments
 (0)