File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -829,7 +829,7 @@ object Types {
829829 */
830830 final def possibleSamMethods (using Context ): Seq [SingleDenotation ] = {
831831 record(" possibleSamMethods" )
832- abstractTermMembers.filterConserve(m =>
832+ abstractTermMembers.toList. filterConserve(m =>
833833 ! m.symbol.matchingMember(defn.ObjectType ).exists && ! m.symbol.isSuperAccessor)
834834 }
835835
@@ -3180,7 +3180,12 @@ object Types {
31803180 private var myParamRefs : List [ParamRefType ] = null
31813181
31823182 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 )
31843189 myParamRefs
31853190 }
31863191
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import reporting._
2222import config .Printers .{exhaustivity => debug }
2323import util .SrcPos
2424import NullOpsDecorator ._
25+ import collection .mutable
2526
2627/** Space logic for checking exhaustivity and unreachability of pattern matching
2728 *
@@ -123,10 +124,13 @@ trait SpaceLogic {
123124 else if (canDecompose(tp) && decompose(tp).isEmpty) Empty
124125 else sp
125126 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
130134
131135 if (set.isEmpty) Empty
132136 else if (set.size == 1 ) set.toList(0 )
You can’t perform that action at this time.
0 commit comments