Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Do not use rangeHash when rangeDiff is 0 [ci: last-only] #10912

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
Nov 12, 2024

Conversation

Friendseeker
Copy link
Contributor

Closes scala/bug#12826 via implementing scala/bug#12826 (comment)

@scala-jenkins scala-jenkins added this to the 2.13.16 milestone Nov 5, 2024
@Friendseeker

This comment was marked as outdated.

@Friendseeker

This comment was marked as outdated.

@Friendseeker

This comment was marked as outdated.

@SethTisue

This comment was marked as resolved.

@SethTisue

This comment was marked as outdated.

@Friendseeker Friendseeker changed the title Do not use rangeHash when rangeDiff is 0 Do not use rangeHash when rangeDiff is 0 [ci: last-only] Nov 5, 2024
@lrytz
Copy link
Member

lrytz commented Nov 5, 2024

LGTM. Can we change hashCode in a minor release?

@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Nov 5, 2024
@SethTisue
Copy link
Member

SethTisue commented Nov 5, 2024

LGTM. Can we change hashCode in a minor release?

Yes, as documented since 2020, as per #9051 and scala/bug#11646 . Admittedly that issue and PR didn't attract much attention/discussion. But they also haven't attracted any pushback, either at the time or in the years since. cc @scala/collections @Ichoran

Let's release-note it regardless (especially since the 2.13.16 release notes won't be that long).

In a Scala 3 context, it's a bit less clear-cut. Normally Scala 3 takes our standard library minor version bumps in their Scala LTS patch version bumps. Does that change the answer here? I would argue it doesn't, because

  • it's documented as being fair game (though I admit there is some ambiguity around the "patch version" wording; we normally say that Scala 2 versions are "epoch.major.minor" not "major.minor.patch", so the doc can be read as referring to Scala 2 minor versions even if it literally says "patch")
  • it's a bugfix or refinement, not a feature addition or design change. we are bringing the implementation in line with an intention that has not changed
  • people realllllllly shouldn't be relying on this stuff not changing — so if it changes once in a while (for a good reason), it's a good reminder of that

I don't doubt that some codebases will see some test failures because they were (perhaps inadvertently) relying on hash order, but IMO our stance should be that those tests were overly sensitive to begin with and it's normal to ask users to either 1) make them less sensitive, or 2) leave them sensitive for convenience but with the awareness that as a consequence they may need adjusting at Scala version bump time.

@OndrejSpanel
Copy link
Member

How will this cope with Seq(17) compared to 17 to 17?

@sjrd
Copy link
Member

sjrd commented Nov 5, 2024

How will this cope with Seq(17) compared to 17 to 17?

In the changed code paths, we already know the size >= 2, so Seq(17) is not affected by this PR.

@lrytz
Copy link
Member

lrytz commented Nov 5, 2024

@Friendseeker could you squash the changes in a single commit?

@Friendseeker
Copy link
Contributor Author

@Friendseeker could you squash the changes in a single commit?

Done!

@lrytz lrytz merged commit 7649050 into scala:2.13.x Nov 12, 2024
3 checks passed
@Friendseeker Friendseeker deleted the range-hash-fix branch November 12, 2024 17:30
hamzaremmal pushed a commit to hamzaremmal/scala3 that referenced this pull request May 2, 2025
Do not use `rangeHash` when `rangeDiff` is 0 [ci: last-only]
hamzaremmal pushed a commit to scala/scala3 that referenced this pull request May 7, 2025
Do not use `rangeHash` when `rangeDiff` is 0 [ci: last-only]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MurmurHash3 produces the same hash for lists of repeated values, regardless of list length
6 participants