File tree 2 files changed +15
-6
lines changed
compiler/src/dotty/tools/dotc
2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -829,7 +829,7 @@ object Types {
829
829
*/
830
830
final def possibleSamMethods (using Context ): Seq [SingleDenotation ] = {
831
831
record(" possibleSamMethods" )
832
- abstractTermMembers.filterConserve(m =>
832
+ abstractTermMembers.toList. filterConserve(m =>
833
833
! m.symbol.matchingMember(defn.ObjectType ).exists && ! m.symbol.isSuperAccessor)
834
834
}
835
835
@@ -3180,7 +3180,12 @@ object Types {
3180
3180
private var myParamRefs : List [ParamRefType ] = null
3181
3181
3182
3182
def paramRefs : List [ParamRefType ] = {
3183
- if (myParamRefs == null ) myParamRefs = paramNames.indices.toList.map(newParamRef)
3183
+ if myParamRefs == null then
3184
+ def recur (paramNames : List [ThisName ], i : Int ): List [ParamRefType ] =
3185
+ paramNames match
3186
+ case _ :: rest => newParamRef(i) :: recur(rest, i + 1 )
3187
+ case _ => Nil
3188
+ myParamRefs = recur(paramNames, 0 )
3184
3189
myParamRefs
3185
3190
}
3186
3191
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import reporting._
22
22
import config .Printers .{exhaustivity => debug }
23
23
import util .SrcPos
24
24
import NullOpsDecorator ._
25
+ import collection .mutable
25
26
26
27
/** Space logic for checking exhaustivity and unreachability of pattern matching
27
28
*
@@ -123,10 +124,13 @@ trait SpaceLogic {
123
124
else if (canDecompose(tp) && decompose(tp).isEmpty) Empty
124
125
else sp
125
126
case Or (spaces) =>
126
- val set = spaces.map(simplify(_)).flatMap {
127
- case Or (ss) => ss
128
- case s => Seq (s)
129
- }.filterConserve(_ != Empty )
127
+ val buf = new mutable.ListBuffer [Space ]
128
+ def include (s : Space ) = if s != Empty then buf += s
129
+ for space <- spaces do
130
+ simplify(space) match
131
+ case Or (ss) => ss.foreach(include)
132
+ case s => include(s)
133
+ val set = buf.toList
130
134
131
135
if (set.isEmpty) Empty
132
136
else if (set.size == 1 ) set.toList(0 )
You can’t perform that action at this time.
0 commit comments