diff options
author | Paul Phillips <paulp@improving.org> | 2009-07-09 18:06:38 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-07-09 18:06:38 +0000 |
commit | 79dc3b49f0ed25fcc7cb33fc8fe1c13a6fdc21b3 (patch) | |
tree | 82b7ad10b7c86db1ad1221cdfd4519ed664ada08 /src/library | |
parent | ccfb3b9c1697379335992b085368557297c72e2d (diff) | |
download | scala-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')
-rw-r--r-- | src/library/scala/Product.scala | 6 |
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 } |