File tree 1 file changed +7
-1
lines changed
compiler/src/dotty/tools/dotc/transform/patmat
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -616,7 +616,7 @@ object SpaceEngine {
616
616
case tp if tp.classSymbol.isAllOf(JavaEnum ) => tp.classSymbol.children.map(_.termRef)
617
617
// the class of a java enum value is the enum class, so this must follow SingletonType to not loop infinitely
618
618
619
- case tp @ AppliedType (Parts (parts), targs) if tp.classSymbol.children.isEmpty =>
619
+ case Childless ( tp @ AppliedType (Parts (parts), targs)) =>
620
620
// It might not obvious that it's OK to apply the type arguments of a parent type to child types.
621
621
// But this is guarded by `tp.classSymbol.children.isEmpty`,
622
622
// meaning we'll decompose to the same class, just not the same type.
@@ -676,6 +676,12 @@ object SpaceEngine {
676
676
final class PartsExtractor (val get : List [Type ]) extends AnyVal :
677
677
def isEmpty : Boolean = get == ListOfNoType
678
678
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
+
679
685
/** Show friendly type name with current scope in mind
680
686
*
681
687
* E.g. C.this.B --> B if current owner is C
You can’t perform that action at this time.
0 commit comments