Skip to content

Fix #8314: Define TupleXXL equals and hashCode as in case classes #8316

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

Merged
merged 1 commit into from
Mar 4, 2020

Conversation

nicolasstucki
Copy link
Contributor

No description provided.


override def toString: String = elems.asInstanceOf[Array[Object]].mkString("(", ",", ")")

override def hashCode: Int = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For case classes we normally delegate to scala.runtime.ScalaRunTime._hashCode, couldn't we do this here too ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can.

Though we do not seem to be delegating ti this method for case classes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that I saw some code generated in the hashCode, which I used as a template for the first implementation. Maybe we are optimizing by mistake something that we should not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a primitive type field in the case class we do write it by hand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then that was the case

@smarter smarter merged commit 7fd5d68 into scala:master Mar 4, 2020
@smarter smarter deleted the fix-#8314 branch March 4, 2020 12:54
@anatoliykmetyuk anatoliykmetyuk added this to the 0.23.0-RC1 milestone Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TupleXXL should use BoxesRunTime instead of java.util.Arrays.{deepEquals, deepHashCode}
4 participants