Skip to content

Commit d14a42c

Browse files
committed
Reorder cases in typeSymbol and classSymbol
1 parent 4fc5828 commit d14a42c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ object Types {
419419
/** The type symbol associated with the type */
420420
@tailrec final def typeSymbol(using Context): Symbol = this match {
421421
case tp: TypeRef => tp.symbol
422-
case tp: ClassInfo => tp.cls
423422
case tp: TypeProxy => tp.underlying.typeSymbol
423+
case tp: ClassInfo => tp.cls
424424
case _: JavaArrayType => defn.ArrayClass
425425
case _ => NoSymbol
426426
}
@@ -430,15 +430,13 @@ object Types {
430430
* value type, or because superclasses are ambiguous).
431431
*/
432432
final def classSymbol(using Context): Symbol = this match {
433-
case ConstantType(constant) =>
434-
constant.tpe.classSymbol
435433
case tp: TypeRef =>
436434
val sym = tp.symbol
437435
if (sym.isClass) sym else tp.superType.classSymbol
438-
case tp: ClassInfo =>
439-
tp.cls
440436
case tp: TypeProxy =>
441437
tp.underlying.classSymbol
438+
case tp: ClassInfo =>
439+
tp.cls
442440
case AndType(l, r) =>
443441
val lsym = l.classSymbol
444442
val rsym = r.classSymbol
@@ -456,13 +454,13 @@ object Types {
456454
/** The least (wrt <:<) set of symbols satisfying the `include` predicate of which this type is a subtype
457455
*/
458456
final def parentSymbols(include: Symbol => Boolean)(using Context): List[Symbol] = this match {
459-
case tp: ClassInfo =>
460-
tp.cls :: Nil
461457
case tp: TypeRef =>
462458
val sym = tp.symbol
463459
if (include(sym)) sym :: Nil else tp.superType.parentSymbols(include)
464460
case tp: TypeProxy =>
465461
tp.underlying.parentSymbols(include)
462+
case tp: ClassInfo =>
463+
tp.cls :: Nil
466464
case AndType(l, r) =>
467465
l.parentSymbols(include) | r.parentSymbols(include)
468466
case OrType(l, r) =>

0 commit comments

Comments
 (0)