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 {
618
618
case tp if tp.classSymbol.isAllOf(JavaEnumTrait ) => tp.classSymbol.children.map(_.termRef)
619
619
// the class of a java enum value is the enum class, so this must follow SingletonType to not loop infinitely
620
620
621
- case tp @ AppliedType (Parts (parts), targs) if tp.classSymbol.children.isEmpty =>
621
+ case Childless ( tp @ AppliedType (Parts (parts), targs)) =>
622
622
// It might not obvious that it's OK to apply the type arguments of a parent type to child types.
623
623
// But this is guarded by `tp.classSymbol.children.isEmpty`,
624
624
// meaning we'll decompose to the same class, just not the same type.
@@ -678,6 +678,12 @@ object SpaceEngine {
678
678
final class PartsExtractor (val get : List [Type ]) extends AnyVal :
679
679
def isEmpty : Boolean = get == ListOfNoType
680
680
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
+
681
687
/** Show friendly type name with current scope in mind
682
688
*
683
689
* E.g. C.this.B --> B if current owner is C
You can’t perform that action at this time.
0 commit comments