Skip to content

Commit c602727

Browse files
committed
Avoid double call to dealias
1 parent 4da0de2 commit c602727

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/reflect/scala/reflect/internal/Definitions.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,19 @@ trait Definitions extends api.StandardDefinitions {
902902
}
903903
}
904904
}
905+
def isVolatileTypeRef(tr: TypeRef) = {
906+
val dealised = tr.dealias
907+
if (dealised ne tr) isVolatile(dealised)
908+
else if (tr.sym.isAbstractType) isVolatileAbstractType
909+
else false
910+
}
905911

906912
tp match {
907913
case ThisType(_) => false
908914
case SingleType(_, sym) => isVolatile(tp.underlying) && (sym.hasVolatileType || !sym.isStable)
909915
case NullaryMethodType(restpe) => isVolatile(restpe)
910916
case PolyType(_, restpe) => isVolatile(restpe)
911-
case TypeRef(_, _, _) if tp ne tp.dealias => isVolatile(tp.dealias)
912-
case TypeRef(_, sym, _) if sym.isAbstractType => isVolatileAbstractType
917+
case tr: TypeRef => isVolatileTypeRef(tr)
913918
case RefinedType(_, _) => isVolatileRefinedType
914919
case TypeVar(origin, _) => isVolatile(origin)
915920
case _: SimpleTypeProxy => isVolatile(tp.underlying)

0 commit comments

Comments
 (0)