Skip to content

Commit

Permalink
consider elements length equal
Browse files Browse the repository at this point in the history
  • Loading branch information
cloud-fan committed May 15, 2015
1 parent d7ff8f4 commit cc02045
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ abstract class Expression extends TreeNode[Expression] {
}.toString
}

def semanticEquals(other: Expression): Boolean = this.getClass == other.getClass &&
this.productIterator.zip(other.asInstanceOf[Product].productIterator).forall {
def semanticEquals(other: Expression): Boolean = this.getClass == other.getClass && {
val elements1 = this.productIterator.toSeq
val elements2 = other.asInstanceOf[Product].productIterator.toSeq
elements1.length == elements2.length && elements1.zip(elements2).forall {
case (e1: Expression, e2: Expression) => e1 semanticEquals e2
case (i1, i2) => i1 == i2
}
}
}

abstract class BinaryExpression extends Expression with trees.BinaryNode[Expression] {
Expand Down

0 comments on commit cc02045

Please sign in to comment.