diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala index c71299b893..b6978f37df 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala @@ -6,9 +6,6 @@ package scala.tools.nsc.transform.patmat -import scala.annotation.tailrec -import scala.collection.immutable.{IndexedSeq, Iterable} -import scala.language.postfixOps import scala.collection.mutable import scala.reflect.internal.util.Statistics @@ -142,7 +139,7 @@ trait TreeAndTypeAnalysis extends Debugging { if(grouped) { def enumerateChildren(sym: Symbol) = { - sym.children.toList + sym.sealedChildren.toList .sortBy(_.sealedSortName) .filterNot(x => x.isSealed && x.isAbstractClass && !isPrimitiveValueClass(x)) } @@ -177,6 +174,8 @@ trait TreeAndTypeAnalysis extends Debugging { filterChildren(subclasses) }) } + case sym if sym.isCase => + List(List(tp)) case sym => debug.patmat("enum unsealed "+ ((tp, sym, sym.isSealed, isPrimitiveValueClass(sym)))) @@ -350,7 +349,7 @@ trait MatchApproximation extends TreeAndTypeAnalysis with ScalaLogic with MatchT object condStrategy extends TypeTestTreeMaker.TypeTestCondStrategy { type Result = Prop def and(a: Result, b: Result) = And(a, b) - def outerTest(testedBinder: Symbol, expectedTp: Type) = True // TODO OuterEqProp(testedBinder, expectedType) + def withOuterTest(testedBinder: Symbol, expectedTp: Type) = True // TODO OuterEqProp(testedBinder, expectedType) def typeTest(b: Symbol, pt: Type) = { // a type test implies the tested path is non-null (null.isInstanceOf[T] is false for all T) val p = binderToUniqueTree(b); And(uniqueNonNullProp(p), uniqueTypeProp(p, uniqueTp(pt))) } @@ -711,9 +710,8 @@ trait MatchAnalysis extends MatchApproximation { val (equal, notEqual) = varAssignment.getOrElse(variable, Nil -> Nil) - def addVarAssignment(equalTo: List[Const], notEqualTo: List[Const]) = { - Map(variable ->(equal ++ equalTo, notEqual ++ notEqualTo)) - } + def addVarAssignment(equalTo: List[Const], notEqualTo: List[Const]) = + Map(variable ->((equal ++ equalTo, notEqual ++ notEqualTo))) // this assignment is needed in case that // there exists already an assign @@ -738,7 +736,7 @@ trait MatchAnalysis extends MatchApproximation { if (expanded.isEmpty) { List(varAssignment) } else { - // we need the cartesian product here, + // we need the Cartesian product here, // since we want to report all missing cases // (i.e., combinations) val cartesianProd = expanded.reduceLeft((xs, ys) => |