Repository navigation
fix: an Array literal of numbers is numeric storage for the Add proof only while its elements are only read - #14586
Merged
Merged
Conversation
added 3 commits
November 12, 2026 23:56
…roof only while the body only reads its elements and length (PERRY_LITERAL_ARRAY_WRITE_CHECK)
|
Caution Review failedThe pull request is closed.
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. |
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.
let t: any = 0; for (..) t = t + a[i]overconst a = [1, 2, 3]after(a as any)[1] = "two"printed1two(node1two3). Tier:collectors/ptr_shape_numeric.rsnumeric_view_value_or_undefined(the Add rule of theNumber-by-construction fixpoint, #8302) took a local whose stable initializer is an Array literal of numbers as numeric
storage whatever the body did with it, so
twas a Number by construction (number_by_construction_locals), theguarded add (
expr/binary.rs) did not testt, and its numeric armfadded the NaN-boxed string, whose payloadsurvived the add. No fact was false (check mode clean): a codegen proof.
retain_unwritten_literal_arrays: a candidate stays numeric storage only while every use of the local in the body(closure bodies and a region's loop control included) is an element read or a
lengthread; applied to thefixpoint's stable initializers and to the
Ptr<Shape>walk's const initializers (the field-numeric claim uses thesame rule).
PERRY_LITERAL_ARRAY_WRITE_CHECK=0= main (registered in compile_env). Chess IR and binary byte-identical on vsoff (the rule never fires on chess).
tests/parity/language/array/test_literal_array_sum_after_store.ts(store viaas any, push, alias, call,closure, fill, the same loop before and after a store; controls: untouched literal, numeric store, typed array, out
of bounds): on MATCH default and check mode; off and main 2 lines differ (
1two 6four 0x 0w 12c 1f).literal_array_sum_loses_its_proof_to_an_element_store(ptr_shape_group_numeric_tests).temporal/test_gap_temporal_keyed_read_chainandobject/test_vr_replacer_hole_main(expected); the same 5 compilefailures as main. Not run: IR census, tssrc, Supabase, skin size, full suites, test262.
Measurement
Common measurement (qb10, perf stat -e instructions:u, taskset -c 30): build m0 = main bee9504 (merge base), build w1 =
bee9504 + PR A (delete) + PR C (Reflect.construct) + PR D (literal array) stacked, head b729f1b7f9; the PRs were then
merged with main 4a36321 (no conflicts in their files' hunks).
| chess (M instr) | search 250000 | perft 4 | evaluate 100000 | legal 10000 |
|