File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
compiler/src/dotty/tools/dotc/transform/patmat Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -116,15 +116,15 @@ trait SpaceLogic {
116
116
/** Simplify space such that a space equal to `Empty` becomes `Empty` */
117
117
def simplify (space : Space )(using Context ): Space = trace(s " simplify ${show(space)} --> " , debug, show)(space match {
118
118
case Prod (tp, fun, spaces) =>
119
- val sps = spaces.map (simplify(_) )
119
+ val sps = spaces.mapconserve (simplify)
120
120
if (sps.contains(Empty )) Empty
121
121
else if (canDecompose(tp) && decompose(tp).isEmpty) Empty
122
- else Prod (tp, fun, sps)
122
+ else if sps eq spaces then space else Prod (tp, fun, sps)
123
123
case Or (spaces) =>
124
- val spaces2 = spaces.map(simplify(_) ).filter(_ != Empty )
124
+ val spaces2 = spaces.map(simplify).filter(_ != Empty )
125
125
if spaces2.isEmpty then Empty
126
- else if spaces2.lengthCompare( 1 ) == 0 then spaces2.head
127
- else Or (spaces2)
126
+ else if spaces2.lengthIs == 1 then spaces2.head
127
+ else if spaces2.corresponds(spaces)(_ eq _) then space else Or (spaces2)
128
128
case Typ (tp, _) =>
129
129
if (canDecompose(tp) && decompose(tp).isEmpty) Empty
130
130
else space
You can’t perform that action at this time.
0 commit comments