From f5d68fb3ab46ea7382d4372d055e0562ab54b6de Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Fri, 23 Mar 2012 18:22:10 +0100 Subject: [vpm] defend against null in erroneous type pats --- src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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 } } -- cgit v1.2.3