summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-07-01 20:32:02 +0000
committerPaul Phillips <paulp@improving.org>2010-07-01 20:32:02 +0000
commit7bee6a54009c4978c0e7511b88c59e68aa39683c (patch)
treee4359de8d8f0ae8315e82f7325e004c968eab947 /src/compiler/scala/tools/nsc/ast/TreeDSL.scala
parent02f73a54eed0d5153a657728b0fa9f3db629d7f4 (diff)
downloadscala-7bee6a54009c4978c0e7511b88c59e68aa39683c.tar.gz
scala-7bee6a54009c4978c0e7511b88c59e68aa39683c.tar.bz2
scala-7bee6a54009c4978c0e7511b88c59e68aa39683c.zip
A crasher in the pattern matcher revealed a fla...
A crasher in the pattern matcher revealed a flaw in how equality comparisons were constructed. Closes #3570, no review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/TreeDSL.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeDSL.scala22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
index 34d3423401..a24c8c01d3 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
@@ -76,20 +76,24 @@ trait TreeDSL {
else gen.mkAnd(target, other)
/** Note - calling ANY_== in the matcher caused primitives to get boxed
- * for the comparison, whereas looking up nme.EQ does not.
+ * for the comparison, whereas looking up nme.EQ does not. See #3570 for
+ * an example of how target.tpe can be non-null, yet it claims not to have
+ * a mmeber called nme.EQ. Not sure if that should happen, but we can be
+ * robust by dragging in Any regardless.
*/
def MEMBER_== (other: Tree) = {
- if (target.tpe == null) ANY_==(other)
- else fn(target, target.tpe member nme.EQ, other)
+ val opSym = if (target.tpe == null) NoSymbol else target.tpe member nme.EQ
+ if (opSym == NoSymbol) ANY_==(other)
+ else fn(target, opSym, other)
}
- def ANY_NE (other: Tree) = fn(target, nme.ne, toAnyRef(other))
def ANY_EQ (other: Tree) = fn(target, nme.eq, toAnyRef(other))
+ def ANY_NE (other: Tree) = fn(target, nme.ne, toAnyRef(other))
def ANY_== (other: Tree) = fn(target, Any_==, other)
- def ANY_>= (other: Tree) = fn(target, nme.GE, other)
- def ANY_<= (other: Tree) = fn(target, nme.LE, other)
- def OBJ_!= (other: Tree) = fn(target, Object_ne, other)
- def OBJ_EQ (other: Tree) = fn(target, nme.eq, other)
- def OBJ_NE (other: Tree) = fn(target, nme.ne, other)
+ def ANY_!= (other: Tree) = fn(target, Any_!=, other)
+ def OBJ_== (other: Tree) = fn(target, Object_==, other)
+ def OBJ_!= (other: Tree) = fn(target, Object_!=, other)
+ def OBJ_EQ (other: Tree) = fn(target, Object_eq, other)
+ def OBJ_NE (other: Tree) = fn(target, Object_ne, other)
def INT_| (other: Tree) = fn(target, getMember(IntClass, nme.OR), other)
def INT_& (other: Tree) = fn(target, getMember(IntClass, nme.AND), other)