Skip to content

Commit 357cc3a

Browse files
committed
Optimize classSymbol of AppliedTypes
Try underlying first, since it is fastest for uncached types.
1 parent 1bd3ed1 commit 357cc3a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,13 @@ object Types {
500500
case tp: TypeRef =>
501501
val sym = tp.symbol
502502
if (sym.isClass) sym else tp.superType.classSymbol
503+
case tp: AppliedType =>
504+
val cls = tp.underlying.classSymbol
505+
if cls == defn.AnyClass
506+
// in that case, `tp` could be a type alias the reduces to an argument;
507+
// need to go through dealias
508+
then tp.superType.classSymbol
509+
else cls
503510
case tp: TypeProxy =>
504511
tp.superType.classSymbol
505512
case tp: ClassInfo =>

0 commit comments

Comments
 (0)