Fixed equality to be symmetric with respect to Atom.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@14555 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
a7487d0098
commit
ebe87cf0d7
|
@ -25,8 +25,9 @@ case class Text(_data: String) extends Atom[String](_data) {
|
|||
throw new java.lang.NullPointerException("tried to construct Text with null")
|
||||
|
||||
final override def equals(x: Any) = x match {
|
||||
case s:String => s.equals(data)
|
||||
case s:String => s == data
|
||||
case s:Text => data == s.data
|
||||
case s:Atom[_] => data == s.data
|
||||
case _ => false
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,10 @@ case class Unparsed(_data: String) extends Atom[String](_data) {
|
|||
throw new java.lang.NullPointerException("tried to construct Unparsed with null")
|
||||
|
||||
final override def equals(x: Any) = x match {
|
||||
case s:String => s.equals(data)
|
||||
case s:String => s == data
|
||||
case s:Text => data == s.data
|
||||
case s:Unparsed => data == s.data
|
||||
case s:Atom[_] => data == s.data
|
||||
case _ => false
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue