File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
compiler/src/dotty/tools/dotc/transform/patmat Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -618,7 +618,7 @@ object SpaceEngine {
618618 case tp if tp.classSymbol.isAllOf(JavaEnumTrait ) => tp.classSymbol.children.map(_.termRef)
619619 // the class of a java enum value is the enum class, so this must follow SingletonType to not loop infinitely
620620
621- case tp @ AppliedType (Parts (parts), targs) if tp.classSymbol.children.isEmpty =>
621+ case Childless ( tp @ AppliedType (Parts (parts), targs)) =>
622622 // It might not obvious that it's OK to apply the type arguments of a parent type to child types.
623623 // But this is guarded by `tp.classSymbol.children.isEmpty`,
624624 // meaning we'll decompose to the same class, just not the same type.
@@ -678,6 +678,12 @@ object SpaceEngine {
678678 final class PartsExtractor (val get : List [Type ]) extends AnyVal :
679679 def isEmpty : Boolean = get == ListOfNoType
680680
681+ object Childless :
682+ def unapply (tp : Type )(using Context ): Result =
683+ Result (if tp.classSymbol.children.isEmpty then tp else NoType )
684+ class Result (val get : Type ) extends AnyVal :
685+ def isEmpty : Boolean = ! get.exists
686+
681687 /** Show friendly type name with current scope in mind
682688 *
683689 * E.g. C.this.B --> B if current owner is C
You can’t perform that action at this time.
0 commit comments