diff options
author | Gerard Basler <gerard.basler@gmail.com> | 2014-12-29 20:34:59 +0100 |
---|---|---|
committer | Gerard Basler <gerard.basler@gmail.com> | 2014-12-29 20:34:59 +0100 |
commit | cb272fefc6836265ec816508c345780560558fbb (patch) | |
tree | 44d573b0d2387600564f2163e5965876a7d895e1 /src | |
parent | 841389bc6f879031a8d36a5ffcca5e3c0e1fdcef (diff) | |
download | scala-cb272fefc6836265ec816508c345780560558fbb.tar.gz scala-cb272fefc6836265ec816508c345780560558fbb.tar.bz2 scala-cb272fefc6836265ec816508c345780560558fbb.zip |
Bugfix: Implement missing `equals` method for `Sym`.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/patmat/Logic.scala | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala index 9f24d5122a..da6527bc0b 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala @@ -122,9 +122,20 @@ trait Logic extends Debugging { // symbols are propositions final class Sym private[PropositionalLogic] (val variable: Var, val const: Const) extends Prop { + + override def equals(other: scala.Any): Boolean = other match { + case that: Sym => this.variable == that.variable && + this.const == that.const + case _ => false + } + + override def hashCode(): Int = { + variable.hashCode * 41 + const.hashCode + } + private val id: Int = Sym.nextSymId - override def toString = variable + "=" + const + "#" + id + override def toString = s"$variable=$const#$id" } object Sym { |