Skip to content

Fix PtrString hash compatibility#468

Merged
quinnj merged 1 commit into
masterfrom
codex/fix-issue-467-ptrstring-hash
Jun 11, 2026
Merged

Fix PtrString hash compatibility#468
quinnj merged 1 commit into
masterfrom
codex/fix-issue-467-ptrstring-hash

Conversation

@quinnj

@quinnj quinnj commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Add reverse AbstractString/PtrString equality so comparisons are symmetric.
  • Add Base.hash(::PtrString, ::UInt) so equal PtrString and String values hash identically.
  • Cover the regression with lazy parser tests for equality, hashing, Dict, and Set lookup.

Root Cause

PtrString defined ==/isequal against AbstractString but did not define a matching hash method. Hash-table lookup also exposed that the equality methods only handled PtrString on the left-hand side.

Validation

  • tmpenv=$(mktemp -d); julia --startup-file=no --project="$tmpenv" -e 'using Pkg; Pkg.develop(path=pwd()); using JSON, Test; include("test/lazy.jl")'
  • tmpenv=$(mktemp -d); julia --startup-file=no --project="$tmpenv" -e 'using Pkg; Pkg.develop(path=pwd()); Pkg.test("JSON")'

Fixes #467

Co-authored by Codex

Ensure PtrString equality with AbstractString is symmetric and hash-compatible so transient lazy keys behave correctly in hashed collections.

Fixes #467
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.41%. Comparing base (6e487a9) to head (7b61d20).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #468      +/-   ##
==========================================
+ Coverage   90.32%   90.41%   +0.09%     
==========================================
  Files           7        7              
  Lines        1416     1419       +3     
==========================================
+ Hits         1279     1283       +4     
+ Misses        137      136       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@quinnj quinnj marked this pull request as ready for review June 11, 2026 21:47
@quinnj quinnj merged commit 4c0e388 into master Jun 11, 2026
11 checks passed
@quinnj quinnj deleted the codex/fix-issue-467-ptrstring-hash branch June 11, 2026 21:47
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.

PtrString defines isequal and == but not hash

1 participant