Skip to content

Private brand check #x in o returns false for real instances #9411

Description

@proggeramlug
class A { #x = 1; static has(o) { return #x in o } }
A.has(new A())   // node: true   perry: false

Also false for #method brands and for subclass instances.

Per ES §13.10.2, #x in o is true when o has the private field installed — which new A() does. Perry answers false, so downleveled TypeScript/Babel brand checks silently take the wrong branch: code that asks "is this one of mine?" concludes no, and falls through to whatever it does for foreign objects.

Silent wrong answer, no error — the failure mode is a wrong code path rather than a crash.

Found by a differential stress-test of claude-code under perry.

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