summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerard Basler <gerard.basler@gmail.com>2014-12-29 20:34:59 +0100
committerGerard Basler <gerard.basler@gmail.com>2014-12-29 20:34:59 +0100
commitcb272fefc6836265ec816508c345780560558fbb (patch)
tree44d573b0d2387600564f2163e5965876a7d895e1
parent841389bc6f879031a8d36a5ffcca5e3c0e1fdcef (diff)
downloadscala-cb272fefc6836265ec816508c345780560558fbb.tar.gz
scala-cb272fefc6836265ec816508c345780560558fbb.tar.bz2
scala-cb272fefc6836265ec816508c345780560558fbb.zip
Bugfix: Implement missing `equals` method for `Sym`.
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/Logic.scala13
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 {