summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-03-23 18:22:10 +0100
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-03-23 18:27:58 +0100
commitf5d68fb3ab46ea7382d4372d055e0562ab54b6de (patch)
tree28ab827a66419e2906e8793234516f0f3a44ae18 /src
parentd38109dad5527e0e54d8296c6a3542a345ab947f (diff)
downloadscala-f5d68fb3ab46ea7382d4372d055e0562ab54b6de.tar.gz
scala-f5d68fb3ab46ea7382d4372d055e0562ab54b6de.tar.bz2
scala-f5d68fb3ab46ea7382d4372d055e0562ab54b6de.zip
[vpm] defend against null in erroneous type pats
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
index 4c5719b33c..3896304a7f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
@@ -258,10 +258,10 @@ trait PatMatVirtualiser extends ast.TreeDSL { self: Analyzer =>
* @arg patBinder symbol used to refer to the result of the previous pattern's extractor (will later be replaced by the outer tree with the correct tree to refer to that patterns result)
*/
def unapply(tree: Tree): Option[(Symbol, Type)] = tree match {
- case Bound(subpatBinder, typed@Typed(expr, tpt)) => Some((subpatBinder, typed.tpe))
- case Bind(_, typed@Typed(expr, tpt)) => Some((patBinder, typed.tpe))
- case Typed(expr, tpt) => Some((patBinder, tree.tpe))
- case _ => None
+ case Bound(subpatBinder, typed@Typed(expr, tpt)) if typed.tpe ne null => Some((subpatBinder, typed.tpe))
+ case Bind(_, typed@Typed(expr, tpt)) if typed.tpe ne null => Some((patBinder, typed.tpe))
+ case Typed(expr, tpt) if tree.tpe ne null => Some((patBinder, tree.tpe))
+ case _ => None
}
}