From 96bf7d6c803b20677a8fdeac59916b5fccceae99 Mon Sep 17 00:00:00 2001 From: Burak Emir Date: Fri, 4 Aug 2006 23:17:41 +0000 Subject: fixed error in opt. --- src/compiler/scala/tools/nsc/matching/PatternMatchers.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala index 72272faf82..3b63f04fdc 100644 --- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala +++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala @@ -1057,10 +1057,12 @@ trait PatternMatchers requires (TransMatcher with PatternNodes) extends AnyRef w toTree(node.and), toTree(node.or, selector.duplicate)); case VariablePat(tree) => - val cmp = if(tree.tpe.symbol.isModuleClass) // objects are compared by eq, not == (avoids unnecessary null-magic) + val cmp = if(tree.tpe.symbol.isModuleClass && // objects are compared by eq, not == (avoids unnecessary null-magic) + selector.tpe <:< definitions.AnyRefClass.tpe) { Eq(selector.duplicate, tree) - else + } else { Equals(selector.duplicate, tree) + } return myIf( cmp, toTree(node.and), toTree(node.or, selector.duplicate)); -- cgit v1.2.3