Skip to content

main: spread push ignores the source iterator after an Array.prototype[Symbol.iterator] patch (#10058 regression) #11772

Description

@proggeramlug

crates/perry/tests/issue_10058_push_spread_scaling.rs::spread_push_is_iterator_correct_and_gc_safe_on_reused_destinations fails on main. It reproduces on cab6d62 and on PR #11680's head. Main's CI skips the cargo-test-perry shards, so the failure doesn't show there.

Cause. The fixture assigns Array.prototype[Symbol.iterator]. The prototype-patch pre-scan from #11394 (c9a5efe, perry-hir/src/patched_builtins.rs) records a computed key as "any member", so it also treats push as patched. Every arr.push(...src) then goes through the generic patched-prototype call (js_array_like_to_array + js_array_concat + js_native_call_method_patched_proto_apply). That path copies the source as an array and never runs its iterator.

Effect. This is a correctness bug, not only a stale assertion: Perry prints own 4 6,1,2,3 where Node prints own 3 6,7,8.

Related, older bug. Even with no prototype patch, f(...own) and o.m(...own) ignore an own Symbol.iterator: Perry prints 1,2,3 where Node prints 7,8.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions