summaryrefslogtreecommitdiff
path: root/src/library/scala/Product.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-07-09 18:06:38 +0000
committerPaul Phillips <paulp@improving.org>2009-07-09 18:06:38 +0000
commit79dc3b49f0ed25fcc7cb33fc8fe1c13a6fdc21b3 (patch)
tree82b7ad10b7c86db1ad1221cdfd4519ed664ada08 /src/library/scala/Product.scala
parentccfb3b9c1697379335992b085368557297c72e2d (diff)
downloadscala-79dc3b49f0ed25fcc7cb33fc8fe1c13a6fdc21b3.tar.gz
scala-79dc3b49f0ed25fcc7cb33fc8fe1c13a6fdc21b3.tar.bz2
scala-79dc3b49f0ed25fcc7cb33fc8fe1c13a6fdc21b3.zip
Implementation and test cases for canEqual meth...
Implementation and test cases for canEqual method in case classes. Now the autogenerated equality method inquires with the argument as to whether other.canEqual(this) before returning true.
Diffstat (limited to 'src/library/scala/Product.scala')
-rw-r--r--src/library/scala/Product.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/library/scala/Product.scala b/src/library/scala/Product.scala
index 2e0a0b2816..bae88f52d7 100644
--- a/src/library/scala/Product.scala
+++ b/src/library/scala/Product.scala
@@ -49,4 +49,10 @@ trait Product extends AnyRef {
*/
def productPrefix = ""
+ /**
+ * An equality helper method to assist in maintaining reflexivity
+ * in the face of subtyping. For more, see
+ * http://www.artima.com/lejava/articles/equality.html
+ */
+ def canEqual(other: Any) = true
}