From b809bf2730a76316082b1e5ba8e6dcef48e7bbc3 Mon Sep 17 00:00:00 2001 From: Burak Emir Date: Fri, 23 Mar 2007 15:10:25 +0000 Subject: fixed bug related to default patterns --- src/compiler/scala/tools/nsc/matching/ParallelMatching.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index f28690ccba..59882a116b 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -57,9 +57,9 @@ trait ParallelMatching requires (transform.ExplicitOuter with PatternMatchers wi (ms,ss,(j,pat)::rs) case _ if (pat.symbol ne null) && (patternType =:= singleType(pat.symbol.tpe.prefix, pat.symbol))=> (EmptyTree::ms, (j,dummies)::ss, rs); // matching an object - case _ if pat.tpe <:< patternType => + case _ if (pat.tpe <:< patternType) => ({if(pat.tpe =:= patternType) EmptyTree else pat}::ms, (j,subpatterns(pat))::ss, rs); // subsumed (same or more specific) pattern; - case _ if patternType <:< pat.tpe => + case _ if (patternType <:< pat.tpe) || isDefaultPattern(pat) => (EmptyTree::ms, (j,dummies)::ss, (j,pat)::rs); // subsuming (matched *and* remaining pattern) case _ => (ms,ss,(j,pat)::rs) @@ -74,6 +74,7 @@ trait ParallelMatching requires (transform.ExplicitOuter with PatternMatchers wi } def getTransition(implicit theOwner: Symbol): (Symbol, Rep, Option[Rep]) = { + DEBUG("*** getTransition! of "+this.toString) // the following works for type tests... what fudge is necessary for value comparisons? // type test casted = if(scrutinee.tpe =:= patternType) scrutinee else newVar(scrutinee.pos, patternType) -- cgit v1.2.3