summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-09-11 17:08:43 +0000
committerPaul Phillips <paulp@improving.org>2009-09-11 17:08:43 +0000
commitf9394a4d472887c4563e768467170a9b1677d5c1 (patch)
tree801fa248907e6c4b611eb35760b4ad641dfb05a6 /src
parent514ff83e3983d81f8bf948abebbe5b9141d9690d (diff)
downloadscala-f9394a4d472887c4563e768467170a9b1677d5c1.tar.gz
scala-f9394a4d472887c4563e768467170a9b1677d5c1.tar.bz2
scala-f9394a4d472887c4563e768467170a9b1677d5c1.zip
Made canEqual abstract in Product and only inse...
Made canEqual abstract in Product and only inserted into case classes if no concrete implementation is inherited. Restored the disabled canEquals usages in collections.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala13
-rw-r--r--src/library/scala/Product.scala7
-rwxr-xr-xsrc/library/scala/collection/SequenceLike.scala2
-rw-r--r--src/library/scala/collection/generic/MapTemplate.scala2
-rw-r--r--src/library/scala/collection/generic/SetTemplate.scala2
-rw-r--r--src/partest/scala/tools/partest/nest/Worker.scala1
6 files changed, 11 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 07914fbc27..d1a746f222 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -39,11 +39,10 @@ trait SyntheticMethods extends ast.TreeDSL {
// to override this method anyways.
protected def typer : Typer = global.typer.asInstanceOf[Typer]
- /**
- * @param templ ...
- * @param clazz ...
- * @param unit ...
- * @return ...
+ /** Add the synthetic methods to case classes. Note that a lot of the
+ * complexity herein is a consequence of case classes inheriting from
+ * case classes, which has been deprecated as of Sep 11 2009. So when
+ * the opportunity for removal arises, this can be simplified.
*/
def addSyntheticMethods(templ: Template, clazz: Symbol, context: Context): Template = {
@@ -142,7 +141,9 @@ trait SyntheticMethods extends ast.TreeDSL {
}
}
- /** The canEqual method for case classes.
+ /** The canEqual method for case classes. Note that if we spot
+ * a user-supplied equals implementation, we simply return true
+ * so as not to interfere.
*/
def canEqualMethod: Tree = {
val method = syntheticMethod(nme.canEqual_, 0, makeTypeConstructor(List(AnyClass.tpe), BooleanClass.tpe))
diff --git a/src/library/scala/Product.scala b/src/library/scala/Product.scala
index a67fb94167..ce8f733771 100644
--- a/src/library/scala/Product.scala
+++ b/src/library/scala/Product.scala
@@ -50,11 +50,4 @@ trait Product extends Equals {
* toString methods.
*/
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
- */
- override def canEqual(other: Any): Boolean = true
}
diff --git a/src/library/scala/collection/SequenceLike.scala b/src/library/scala/collection/SequenceLike.scala
index bd62590c4c..baa4d47646 100755
--- a/src/library/scala/collection/SequenceLike.scala
+++ b/src/library/scala/collection/SequenceLike.scala
@@ -445,7 +445,7 @@ trait SequenceLike[+A, +Repr] extends IterableLike[A, Repr] { self =>
override def hashCode() = (Sequence.hashSeed /: this)(_ * 41 + _.hashCode)
override def equals(that: Any): Boolean = that match {
- case that: Sequence[_] => /*(that canEqual this)!!! &&*/ (this sameElements that)
+ case that: Sequence[_] => (that canEqual this) && (this sameElements that)
case _ => false
}
diff --git a/src/library/scala/collection/generic/MapTemplate.scala b/src/library/scala/collection/generic/MapTemplate.scala
index 2bd15ee315..cf0fdcbc3d 100644
--- a/src/library/scala/collection/generic/MapTemplate.scala
+++ b/src/library/scala/collection/generic/MapTemplate.scala
@@ -277,7 +277,7 @@ self =>
override def equals(that: Any): Boolean = that match {
case that: Map[b, _] =>
(this eq that) ||
- /*(that canEqual this) && !!!*/
+ (that canEqual this) &&
(this.size == that.size) && {
try {
this forall {
diff --git a/src/library/scala/collection/generic/SetTemplate.scala b/src/library/scala/collection/generic/SetTemplate.scala
index f0e735133b..88061cb4f5 100644
--- a/src/library/scala/collection/generic/SetTemplate.scala
+++ b/src/library/scala/collection/generic/SetTemplate.scala
@@ -176,7 +176,7 @@ self =>
override def equals(that: Any): Boolean = that match {
case that: Set[A] =>
(this eq that) ||
- /*(that canEqual this) &&!!!*/
+ (that canEqual this) &&
(this.size == that.size) &&
(try this subsetOf that.asInstanceOf[Set[A]]
catch { case ex: ClassCastException => false })
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala
index bb51a5049b..0473955ed9 100644
--- a/src/partest/scala/tools/partest/nest/Worker.scala
+++ b/src/partest/scala/tools/partest/nest/Worker.scala
@@ -778,6 +778,7 @@ class Worker(val fileManager: FileManager) extends Actor {
val resFile = results(0)
// 2. Compile source file
if (!compileMgr.shouldCompile(outDir, List(file), kind, logFile)) {
+ NestUI.verbose("compilerMgr failed to compile %s to %s".format(file, outDir))
succeeded = false
} else {