diff options
author | Burak Emir <emir@epfl.ch> | 2008-04-07 04:10:08 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2008-04-07 04:10:08 +0000 |
commit | e5fedb805976761eb67b5ed5876c6ee8c0ba6daa (patch) | |
tree | b37100e589f02b0f231f28fcc4463ce4b65cabf7 /src | |
parent | fbd2b0caac60c33408c0dd1906855617c4e188fb (diff) | |
download | scala-e5fedb805976761eb67b5ed5876c6ee8c0ba6daa.tar.gz scala-e5fedb805976761eb67b5ed5876c6ee8c0ba6daa.tar.bz2 scala-e5fedb805976761eb67b5ed5876c6ee8c0ba6daa.zip |
fixed #346
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/ParallelMatching.scala | 17 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/PatternNodes.scala | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index 9204b6f1db..7bcc73295f 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -802,8 +802,9 @@ trait ParallelMatching { val (casted,srep,frep) = this.getTransition val condUntyped = condition(casted.tpe, this.scrutinee) var cond = rep.handleOuter(typed { condUntyped }) - if (needsOuterTest(casted.tpe, this.scrutinee.tpe, theOwner)) // @todo merge into def condition + if (needsOuterTest(casted.tpe, this.scrutinee.tpe, theOwner)) { // @todo merge into def condition cond = addOuterCondition(cond, casted.tpe, mkIdent(this.scrutinee), rep.handleOuter) + } val succ = repToTree(srep) val fail = if (frep.isEmpty) failTree else repToTree(frep.get) @@ -1346,14 +1347,15 @@ trait ParallelMatching { assert(scrutineeTree.tpe ne NoType) if (tpe.isInstanceOf[SingletonType] && !tpe.isInstanceOf[ConstantType]) { if (tpe.termSymbol.isModule) {// object - if (scrutineeTree.tpe <:< definitions.AnyRefClass.tpe) - Eq(gen.mkAttributedRef(tpe.termSymbol), scrutineeTree) // object - else + //if (scrutineeTree.tpe <:< definitions.AnyRefClass.tpe) + // Eq(gen.mkAttributedRef(tpe.termSymbol), scrutineeTree) // object + //else Equals(gen.mkAttributedRef(tpe.termSymbol), scrutineeTree) // object } else { val x = - if (tpe.prefix ne NoPrefix) gen.mkIsInstanceOf(scrutineeTree, tpe) - else Equals(gen.mkAttributedRef(tpe.termSymbol), scrutineeTree) + //if (tpe.prefix ne NoPrefix) gen.mkIsInstanceOf(scrutineeTree, tpe) + //else + Equals(gen.mkAttributedRef(tpe.termSymbol), scrutineeTree) typed { x } } } else if (tpe.isInstanceOf[ConstantType]) { @@ -1364,8 +1366,9 @@ trait ParallelMatching { Equals(scrutineeTree, Literal(value)) // constant } else if (scrutineeTree.tpe <:< tpe && tpe <:< definitions.AnyRefClass.tpe) { NotNull(scrutineeTree) - } else + } else { gen.mkIsInstanceOf(scrutineeTree, tpe) + } } /** adds a test comparing the dynamic outer to the static outer */ diff --git a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala index 030e46175f..26cf79cb43 100644 --- a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala +++ b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala @@ -131,7 +131,7 @@ trait PatternNodes { self: transform.ExplicitOuter => // case Typed(nme.WILDCARD,_) => pattern.tpe <:< scrutinee.tpe } - final def DBG(x:String) { if(settings_debug) Console.println(x) } + final def DBG(x:String) { if (settings_debug) Console.println(x) } /** returns all variables that are binding the given pattern * @param x a pattern |