Skip to content

Commit b6c139a

Browse files
committed
Reorder cases in typeSymbol and classSymbol
1 parent 6a43262 commit b6c139a

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
@@ -418,8 +418,8 @@ object Types {
418418
/** The type symbol associated with the type */
419419
@tailrec final def typeSymbol(using Context): Symbol = this match {
420420
case tp: TypeRef => tp.symbol
421-
case tp: ClassInfo => tp.cls
422421
case tp: TypeProxy => tp.underlying.typeSymbol
422+
case tp: ClassInfo => tp.cls
423423
case _: JavaArrayType => defn.ArrayClass
424424
case _ => NoSymbol
425425
}
@@ -429,15 +429,13 @@ object Types {
429429
* value type, or because superclasses are ambiguous).
430430
*/
431431
final def classSymbol(using Context): Symbol = this match {
432-
case ConstantType(constant) =>
433-
constant.tpe.classSymbol
434432
case tp: TypeRef =>
435433
val sym = tp.symbol
436434
if (sym.isClass) sym else tp.superType.classSymbol
437-
case tp: ClassInfo =>
438-
tp.cls
439435
case tp: TypeProxy =>
440436
tp.underlying.classSymbol
437+
case tp: ClassInfo =>
438+
tp.cls
441439
case AndType(l, r) =>
442440
val lsym = l.classSymbol
443441
val rsym = r.classSymbol
@@ -455,13 +453,13 @@ object Types {
455453
/** The least (wrt <:<) set of symbols satisfying the `include` predicate of which this type is a subtype
456454
*/
457455
final def parentSymbols(include: Symbol => Boolean)(using Context): List[Symbol] = this match {
458-
case tp: ClassInfo =>
459-
tp.cls :: Nil
460456
case tp: TypeRef =>
461457
val sym = tp.symbol
462458
if (include(sym)) sym :: Nil else tp.superType.parentSymbols(include)
463459
case tp: TypeProxy =>
464460
tp.underlying.parentSymbols(include)
461+
case tp: ClassInfo =>
462+
tp.cls :: Nil
465463
case AndType(l, r) =>
466464
l.parentSymbols(include) | r.parentSymbols(include)
467465
case OrType(l, r) =>

0 commit comments

Comments
 (0)