Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3fafbc2

Browse filesBrowse files
committed
Merge pull request #4222 from gbasler/topic/patmat-unit-tests-rebased
Add unit tests for Tseitin CNF conversion and implement missing `equals` method for `Sym`.
2 parents 409b280 + 5c296a4 commit 3fafbc2
Copy full SHA for 3fafbc2

File tree

Expand file treeCollapse file tree

2 files changed

+567
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+567
-1
lines changed

‎src/compiler/scala/tools/nsc/transform/patmat/Logic.scala

Copy file name to clipboardExpand all lines: src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,20 @@ trait Logic extends Debugging {
122122

123123
// symbols are propositions
124124
final class Sym private[PropositionalLogic] (val variable: Var, val const: Const) extends Prop {
125+
126+
override def equals(other: scala.Any): Boolean = other match {
127+
case that: Sym => this.variable == that.variable &&
128+
this.const == that.const
129+
case _ => false
130+
}
131+
132+
override def hashCode(): Int = {
133+
variable.hashCode * 41 + const.hashCode
134+
}
135+
125136
private val id: Int = Sym.nextSymId
126137

127-
override def toString = variable + "=" + const + "#" + id
138+
override def toString = s"$variable=$const#$id"
128139
}
129140

130141
object Sym {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.