test(codegen): fix number-context coupled-arms test after #11588 + #11589 - #11603
Conversation
…o count literals #11588 (forwarding hop, +3 blocks) and #11589 (byte-view arm, +3 blocks) each bumped the coupled-coercion test's hardcoded block count from 21 to 24; merged, the site has 27 blocks and the literal was stale. The codegen is correct: the byte-view arm yields a uitofp byte (a Number by construction, like the typed-array width arms) and the forwarding hop yields no value. Both tests now compare against one shared DYNAMIC_INDEX_SITE_BLOCKS list (the full ordered shape, stronger than a length), and the coupled test additionally asserts the u8 and tav.w* arms never coerce.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughDynamic index read tests now use one shared ordered block-label list for site-shape checks. The number-context test also checks that byte-view and typed-array load arms do not coerce their results, and that byte-view loads use unsigned-byte conversion. ChangesDynamic Index Read Tests
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Other Merge Risk: ⚪ Minimal · up to This PR strengthens dynamic-index codegen regression tests without changing production code. The added checks cover the stated load arms, and no merge-blocking risk is evident. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings
🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
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 |
Follow-up to #11588 and #11589
mainis red in perry-codegen lib tests:expr::index_get_claim_tests::the_number_context_coercion_is_coupled_across_every_armfails withleft: 27, right: 24.Root cause
It was a test merge collision, not a codegen defect. The coupled-coercion test asserted the dynamic
obj[i]site's block count as a literal. #11588 (a growth-forwarding hop:fwd_check/fwd_follow/fwd_header) and #11589 (the byte-view arm:u8.brand/u8.bounds/u8.load) each bumped that literal from 21 to 24 on its own. Together the site has 27 blocks. The sibling test's full block list merged cleanly, but the count literal did not.The codegen already satisfies the invariant. The byte-view arm's value is a
uitofpbyte, which is a Number by construction, the same as thetav.w*typed-array arms (these never coerce by design; see thelower_inline_dyn_typed_array_getdoc). The forwarding hop produces no value and only re-entersarrlike.ic.brand. The number-context and plain IR shapes are identical.Fix (test-only, and stricter)
DYNAMIC_INDEX_SITE_BLOCKSlist now pins the full ordered site shape. Both tests compare against it, so the coupled test checks the exact sequence instead of just a length. A future arm updates one list.arrlike.u8.loadandtav.w8/w4/w2/w1must never calljs_number_coerce, and the u8 value must be auitofp i8.No emitted IR changes, so there is no perf impact on the #11588/#11589 wins.
Validation
origin/main(efc0cb5):left: 27, right: 24. Passes with this change.cargo test -p perry-codegen: 42 test binaries, 0 failures (lib: 1787 passed, 1 ignored).cargo fmt --all -- --checkOK.scripts/check_file_size.shOK.Not run: the gap suite, other crates' tests, and
run_lint_gates.sh. This is a codegen test-only change.Summary by CodeRabbit