test(typed-array): re-pin fractional-index expectation to spec-correct undefined (unblocks cargo-test on main) - #6961
Merged
Conversation
…t undefined inline_typed_array_fast_path_matches_slow_path asserted g(t,1.5) === g(t,1) — a deliberate encoding of the truncate-a-fractional-index quirk, as its own comment documented. Per 10.4.5.2 a non-integral canonical numeric index is not an own property, so [[Get]] yields undefined; #6903 (representation- selection Phase 1) made both the inline and slow paths spec-correct, so the pinned string stopped matching and cargo-test has been red on main since the Jul 28 nightly. The invariant the test protects (inline == slow) still holds — both paths return undefined for 1.5 / -0.5 / 2.7, on an inline-eligible receiver and under PERRY_TA_VIEW_GUARD, byte-identical to node. Correct the expectation, rewrite the comment to cite the spec + the commit that fixed the quirk, and add a B2 line asserting the values are === undefined: the old form only asserted 'differs from t[1]', which a regression returning some other wrong value would still pass. Test-only; no runtime or codegen changes.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe regression test now verifies that fractional and NaN-like typed-array indices return ChangesTyped-array fractional indexing
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What
Fixes the
inline_typed_array_fast_path_matches_slow_pathfailure that has heldcargo-testred on main since the Jul 28 nightly (it replaced the proxy failure that #6907 cleared, and it currently blocks the v0.5.1265 release gate).This is a stale test expectation, not a code regression — the runtime got more spec-correct and the test was pinned to the old bug.
Root cause
Section (B) asserted
g(t, 1.5) === g(t, 1)fort = new Int32Array(3), i.e. that a fractional index truncates to1. The test's own comment documented this as a deliberate encoding of a known-wrong behavior:Per §10.4.5.2, a non-integral canonical numeric index is not an own property of an integer-indexed exotic object, so
[[Get]]yieldsundefined. #6903 (representation-selection Phase 1 — canonical unboxed i32 locals) made both the inline and slow paths spec-correct, so the comparison is nowfalseand the pinned string no longer matches.Attribution is solid from both directions: the Jul 27 nightly (
b5727f305, pre-#6903) did not fail this test, the Jul 28 nightly (95960e0df, post-#6903) does, and buildingb0d789dab(#6903) directly reproduces the newB=true,true,false,true.Why this is safe to re-pin rather than revert
The invariant the test exists to protect — inline path == slow path — still holds; only the shared value changed. Verified directly with a probe that exercises both paths on the same inputs:
node --experimental-strip-typesproduces exactly the same three lines, and the sameB=true,true,false,truefor the test's own section (B). So the paths agree with each other and with node.Changes
B=true,true,false,trueand rewrite the (B) comment to explain that the quirk was fixed by perf(codegen): representation-selection Phase 1 — canonical unboxed i32 locals #6903, citing §10.4.5.2, instead of documenting it as permanent.B2line assertingt[1.5]/t[-0.5]/t[2.7]are each=== undefined. The old (B) form only asserted "not equal tot[1]", which a future regression returning some other wrong value (0, garbage, a truncated read of a different slot) would still satisfy. B2 pins the actual value, so this test now guards the corrected behavior rather than merely tolerating it.Test-only change; no runtime or codegen code is touched.
Summary by CodeRabbit
Bug Fixes
1.5correctly returnundefinedinstead of being treated as truncated integer indices.Tests