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 @@ -616,7 +616,7 @@ object SpaceEngine {
616616 case tp if tp.classSymbol.isAllOf(JavaEnum ) => tp.classSymbol.children.map(_.termRef)
617617 // the class of a java enum value is the enum class, so this must follow SingletonType to not loop infinitely
618618
619- case tp @ AppliedType (Parts (parts), targs) if tp.classSymbol.children.isEmpty =>
619+ case Childless ( tp @ AppliedType (Parts (parts), targs)) =>
620620 // It might not obvious that it's OK to apply the type arguments of a parent type to child types.
621621 // But this is guarded by `tp.classSymbol.children.isEmpty`,
622622 // meaning we'll decompose to the same class, just not the same type.
@@ -676,6 +676,12 @@ object SpaceEngine {
676676 final class PartsExtractor (val get : List [Type ]) extends AnyVal :
677677 def isEmpty : Boolean = get == ListOfNoType
678678
679+ object Childless :
680+ def unapply (tp : Type )(using Context ): Result =
681+ Result (if tp.classSymbol.children.isEmpty then tp else NoType )
682+ class Result (val get : Type ) extends AnyVal :
683+ def isEmpty : Boolean = ! get.exists
684+
679685 /** Show friendly type name with current scope in mind
680686 *
681687 * E.g. C.this.B --> B if current owner is C
You can’t perform that action at this time.
0 commit comments