We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
canDecompose
1 parent 75c4f38 commit 50b03c0Copy full SHA for 50b03c0
compiler/src/dotty/tools/dotc/transform/patmat/Space.scala
@@ -476,11 +476,12 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
476
477
/** Abstract sealed types, or-types, Boolean and Java enums can be decomposed */
478
def canDecompose(tp: Type): Boolean = {
479
+ val dealiasedTp = tp.dealias
480
val res = tp.classSymbol.is(allOf(Abstract, Sealed)) ||
481
tp.classSymbol.is(allOf(Trait, Sealed)) ||
- tp.dealias.isInstanceOf[OrType] ||
482
- (tp.isInstanceOf[AndType] && {
483
- val and = tp.asInstanceOf[AndType]
+ dealiasedTp.isInstanceOf[OrType] ||
+ (dealiasedTp.isInstanceOf[AndType] && {
484
+ val and = dealiasedTp.asInstanceOf[AndType]
485
canDecompose(and.tp1) || canDecompose(and.tp2)
486
}) ||
487
tp =:= ctx.definitions.BooleanType ||
0 commit comments