Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic change of nested case class equality b/w 2.9 and 2.10 #6911

Closed
scabug opened this issue Jan 4, 2013 · 3 comments
Closed

Semantic change of nested case class equality b/w 2.9 and 2.10 #6911

scabug opened this issue Jan 4, 2013 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jan 4, 2013

There's regression from 2.9.2 when it comes to nested case class equality:

trait K { 
case class CC(name: String) 
}

object Foo extends K 
object Bar extends K

val b1 = Foo.CC("b") 
val b2 = Bar.CC("b")

b1 == b2 // false under 2.9, true under 2.10-RC5

This change is caused by different scheme used for case class equality. It changed from:

def oldEq(that: Any) = that match { 
case K.this.CC(n) => n == this.name && that.asInstanceOf[K.this.CC].canEqual(this) 
case _ => false 
}

to using asInstanceOf, like:

def newEq(that: Any) = that.isInstanceOf[K.this.CC] && { 
val f = that.asInstanceOf[K.this.CC] 
(f.name == this.name) && f.canEqual(this) 
}

The change has been introduced in scala/scala@f7f5b50

Since this is a silent change of user's code behavior I'm marking this blocker for 2.10.1.

@scabug
Copy link
Author

@scabug scabug commented Jan 4, 2013

Imported From: https://issues.scala-lang.org/browse/SI-6911?orig=1
Reporter: @gkossakowski
Affected Versions: 2.10.0-RC5
See #6583

@scabug
Copy link
Author

@scabug scabug commented Jan 4, 2013

@paulp said:
I'll put it on the short list.

@scabug
Copy link
Author

@scabug scabug commented Jan 4, 2013

@scabug scabug closed this Jan 11, 2013
@scabug scabug added this to the 2.10.1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants