summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-11-16 21:56:00 +0000
committerPaul Phillips <paulp@improving.org>2009-11-16 21:56:00 +0000
commit60e6a45de9e713d007cea6af3b71605d5d08e06b (patch)
treea1eb71370e1057465638f674aec426d77fc114cb
parenta3926747d3aeed76e42b4cd0cdce17dd4a736d14 (diff)
downloadscala-60e6a45de9e713d007cea6af3b71605d5d08e06b.tar.gz
scala-60e6a45de9e713d007cea6af3b71605d5d08e06b.tar.bz2
scala-60e6a45de9e713d007cea6af3b71605d5d08e06b.zip
Fix for #2647.
-rw-r--r--src/library/scala/xml/Node.scala9
-rw-r--r--src/library/scala/xml/NodeSeq.scala2
2 files changed, 5 insertions, 6 deletions
diff --git a/src/library/scala/xml/Node.scala b/src/library/scala/xml/Node.scala
index 5636c7ddcc..c5b990fe88 100644
--- a/src/library/scala/xml/Node.scala
+++ b/src/library/scala/xml/Node.scala
@@ -142,6 +142,7 @@ abstract class Node extends NodeSeq {
this.prefix == that.prefix &&
this.label == that.label &&
this.attributes == that.attributes &&
+ this.scope == that.scope &&
equalChildren(that)
case _ => false
}
@@ -157,13 +158,11 @@ abstract class Node extends NodeSeq {
}
/** <p>
- * Returns a hashcode. The default implementation here calls only
- * super.hashcode (which is the same as for objects). A more useful
- * implementation can be invoked by calling
- * <code>Utility.hashCode(pre, label, attributes.hashCode(), child)</code>.
+ * Returns a hashcode.
* </p>
*/
- override def hashCode(): Int = super.hashCode
+ override def hashCode(): Int =
+ Utility.hashCode(prefix, label, attributes.hashCode(), scope.hashCode(), child)
// implementations of NodeSeq methods
diff --git a/src/library/scala/xml/NodeSeq.scala b/src/library/scala/xml/NodeSeq.scala
index de6e38d5b7..cae43cb621 100644
--- a/src/library/scala/xml/NodeSeq.scala
+++ b/src/library/scala/xml/NodeSeq.scala
@@ -56,7 +56,7 @@ abstract class NodeSeq extends immutable.Seq[Node] with SeqLike[Node, NodeSeq] {
def apply(i: Int): Node = theSeq(i)
def apply(f: Node => Boolean): NodeSeq = filter(f)
- /** structural equality */
+ /** structural equality (XXX - this shatters any hope of hashCode equality) */
override def equals(x: Any): Boolean = x match {
case z:Node => (length == 1) && z == apply(0)
case z:Seq[_] => sameElements(z)