summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-03-22 10:02:16 +0000
committerBurak Emir <emir@epfl.ch>2007-03-22 10:02:16 +0000
commit8d3c44cfb9ccacc85e6c310542b3f74bb416cbcd (patch)
tree6161f86565effe30dbb19d8aa9ba93fcb9406c79
parentf70a92677c714ebdc4831e4a093567325125e690 (diff)
downloadscala-8d3c44cfb9ccacc85e6c310542b3f74bb416cbcd.tar.gz
scala-8d3c44cfb9ccacc85e6c310542b3f74bb416cbcd.tar.bz2
scala-8d3c44cfb9ccacc85e6c310542b3f74bb416cbcd.zip
fixed coverage checking to use <:< (Adriaan's b...
fixed coverage checking to use <:< (Adriaan's bug for typed pattern _:List)
-rw-r--r--src/compiler/scala/tools/nsc/matching/ParallelMatching.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
index a49984a4de..f28690ccba 100644
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
@@ -317,9 +317,12 @@ trait ParallelMatching requires (transform.ExplicitOuter with PatternMatchers wi
val allcomb = combine(sealedCols zip sealedComb)
//Console.println("all comb!" + allcomb)
- // returns true if pattern vector covers all type symbols
+ /** returns true if pattern vector pats covers a type symbols "combination"
+ * @param pats pattern vector
+ * @param comb pairs of (column index, type symbol)
+ */
def covers(pats: List[Tree], comb:List[(Int,Symbol)]) = {
- comb forall { case (i,sym) => pats(i).tpe.symbol == sym }
+ comb forall { case (i,sym) => val p = pats(i); p.tpe.symbol == sym || sym.tpe <:< p.tpe }
}
val coversAll = allcomb forall { combination => row exists { r => covers(r._1, combination)}}
//Console.println("all combinations covered? "+coversAll)