Fix the MarkedString hash test on Julia 1.13 - #1429
Merged
Merged
Conversation
The #1381 regression test compared `hash(x)` against `hash(x, zero(UInt))`. Julia 1.13 stopped defining the generic one-arg `hash(x)` as `hash(x, zero(UInt))`, so that comparison is now false for every type, `Int` included, and says nothing about `MarkedString` any more. What #1381 actually was is a stray one-arg `Base.hash(x::MarkedString)`, which made hashing identity-based and broke `Dict` and `unique`. Assert that no such method exists instead: `which(hash, Tuple{MarkedString})` has to resolve to the generic `hash(x)`. That catches the original regression on every supported version, and the value-based invariants around it are unchanged. 32/32 on both 1.12.7 and 1.13.0-rc3. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Julia 1.13 stopped defining the generic one-arg
hash(x)ashash(x, zero(UInt)). The regression test for #1381 compared exactly those two, so it now fails on 1.13 — and the comparison is false for every type there,Intincluded, so it says nothing aboutMarkedStringany more.#1381 itself was a stray one-arg
Base.hash(x::MarkedString)that made hashing identity-based and brokeDictandunique. This asserts that no such method exists —which(hash, Tuple{MarkedString})has to resolve to the generichash(x)— which catches the original regression on every supported version. The value-based invariants next to it are unchanged.Found while auditing the stack for Julia 1.13 readiness.
Verified: 32/32 on 1.12.7 and on 1.13.0-rc3.
🤖 Generated with Claude Code