From c21980c483ff2c95278bc9de40cb1f2e3375e6fe Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 24 Mar 2010 14:29:04 +0000 Subject: Fixes problematic equality of Enumeration values. --- src/library/scala/Enumeration.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala index 09504046ea..1346f4f469 100644 --- a/src/library/scala/Enumeration.scala +++ b/src/library/scala/Enumeration.scala @@ -65,7 +65,7 @@ private object Enumeration { */ @serializable @SerialVersionUID(8476000850333817230L) -abstract class Enumeration(initial: Int, names: String*) { +abstract class Enumeration(initial: Int, names: String*) { thisenum => def this() = this(0, null) def this(names: String*) = this(0, names: _*) @@ -228,7 +228,7 @@ abstract class Enumeration(initial: Int, names: String*) { override def compare(that: Value): Int = this.id - that.id override def equals(other: Any): Boolean = other match { - case that: Value => compare(that) == 0 + case that: thisenum.Value => compare(that) == 0 case _ => false } override def hashCode: Int = id.hashCode -- cgit v1.2.3