Skip to content

<index> in <typed array> and "length"/method in <typed array> report false #6148

Description

@proggeramlug

Summary

<index> in <typed array> returns false for valid in-bounds indices, and
<method> in <typed array> / "length" in <typed array> also report false.

Repro

const ta = new Uint8Array([10, 20, 30]);
console.log(0 in ta);          // node: true   perry: false
console.log(2 in ta);          // node: true   perry: false
console.log(3 in ta);          // node: false  perry: false ✓
console.log("length" in ta);   // node: true   perry: false
console.log("subarray" in ta); // node: true   perry: false

Notes

Pre-existing (reproduces on main). The typed-array arm in
js_object_has_property (has_property.rs) is reached only when
lookup_typed_array_kind matches; a small typed array whose backing is
off-heap (no GcHeader) appears not to resolve there, so in falls through and
reports absent. Separate from the Object.create in fix (#6145).

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