File tree 1 file changed +3
-6
lines changed
compiler/src/dotty/tools/dotc/transform/patmat
1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -132,20 +132,17 @@ trait SpaceLogic {
132
132
133
133
/** Remove a space if it's a subspace of remaining spaces
134
134
*
135
- * Note: `dedup` will return the same result if the sequence > 10
135
+ * Note: `dedup` will return the same result if the sequence >= 10
136
136
*/
137
- def dedup (spaces : Seq [Space ])(using Context ): Seq [Space ] = {
138
- val total = spaces.take(10 )
139
-
140
- if (total.size < 1 || total.size >= 10 ) total
137
+ def dedup (spaces : Seq [Space ])(using Context ): Seq [Space ] =
138
+ if (spaces.lengthCompare(1 ) <= 0 || spaces.lengthCompare(10 ) >= 0 ) spaces
141
139
else {
142
140
val res = spaces.map(sp => (sp, spaces.filter(_ ne sp))).find {
143
141
case (sp, sps) => isSubspace(sp, Or (LazyList (sps : _* )))
144
142
}
145
143
if (res.isEmpty) spaces
146
144
else res.get._2
147
145
}
148
- }
149
146
150
147
/** Flatten space to get rid of `Or` for pretty print */
151
148
def flatten (space : Space )(using Context ): Seq [Space ] = space match {
You can’t perform that action at this time.
0 commit comments