Skip to content

Commit efe52bd

Browse files
committed
Space: Make isSubspace use simplified spaces only, by recursing
That avoids references to un-simplified a and b.
1 parent 9680ef9 commit efe52bd

File tree

1 file changed

+4
-1
lines changed
  • compiler/src/dotty/tools/dotc/transform/patmat

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ trait SpaceLogic {
169169
def tryDecompose1(tp: Type) = canDecompose(tp) && isSubspace(Or(decompose(tp)), b)
170170
def tryDecompose2(tp: Type) = canDecompose(tp) && isSubspace(a, Or(decompose(tp)))
171171

172-
(simplify(a), simplify(b)) match {
172+
val a2 = simplify(a)
173+
val b2 = simplify(b)
174+
if (a ne a2) || (b ne b2) then isSubspace(a2, b2)
175+
else (a, b) match {
173176
case (Empty, _) => true
174177
case (_, Empty) => false
175178
case (Or(ss), _) =>

0 commit comments

Comments
 (0)