Skip to content

(true).__proto__ and (1n).__proto__ return undefined instead of Boolean.prototype/BigInt.prototype — their dispatch never reaches Object.prototype's accessor table #10648

Description

@proggeramlug

Found while fixing #10482 (PR #10647), which installed Object.prototype.__proto__ as a real accessor descriptor.
Confirmed pre-existing — that PR neither caused nor changed this.

console.log((true).__proto__ === Boolean.prototype);   // Node: true   Perry: false (undefined)
console.log((1n).__proto__  === BigInt.prototype);     // Node: true   Perry: false (undefined)

Boolean and BigInt primitives return undefined for a dynamic .__proto__ read, where Node gives their
wrapper prototype.

Why Number/String work and these don't: PR #10647 fixed the recursive prototype-chain fallback in
primitive_builtin_prototype_property (crates/perry-runtime/src/object/field_get_set/accessors.rs) to preserve
the original primitive receiver via accessor_receiver_override_begin/_end, so (5).__proto__ now correctly
resolves to Number.prototype instead of the intermediate Object.prototype. Boolean/BigInt never reach
Object.prototype's accessor table at all — their dispatch takes a different route — so that fix does not apply
to them.

Start by finding where boolean and bigint property reads diverge from the number/string path; the fix is probably
routing them through the same fallback rather than adding a new mechanism.

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

    package-auditFound by the 2026 package audit: compiling real npm packages from source instead of native bindings

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions