Skip to content

Commit 7799da6

Browse files
committed
address review: simplify CNF conversion
1 parent a913f77 commit 7799da6

File tree

1 file changed

+3
-6
lines changed
  • compiler/src/dotty/tools/dotc/transform/patmat

1 file changed

+3
-6
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
510510
// convert top-level type shape into "conjunctive normal form"
511511
def cnf(tp: Type): Type = tp match {
512512
case AndType(OrType(l, r), tp) =>
513-
val tp1 = cnf(tp)
514-
val l1 = cnf(l)
515-
val r1 = cnf(r)
516-
OrType(cnf(AndType(l1, tp1)), cnf(AndType(r1, tp1)))
513+
OrType(cnf(AndType(l, tp)), cnf(AndType(r, tp)))
517514
case AndType(tp, o: OrType) =>
518515
cnf(AndType(o, tp))
519516
case AndType(l, r) =>
@@ -533,9 +530,9 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
533530
val tp1 = tp.derivedRefinedType(parent1, refinedName = tp.refinedName, refinedInfo = tp.refinedInfo)
534531

535532
if (parent1.ne(tp.parent)) cnf(tp1) else tp1
536-
case tp: TypeAlias =>
533+
case tp: TypeAlias =>
537534
cnf(tp.alias)
538-
case _ =>
535+
case _ =>
539536
tp
540537
}
541538

0 commit comments

Comments
 (0)