Skip to content

fix(expressions): AssignmentTargetType validation — ReferenceError vs SyntaxError (7 tests) #428

Description

@dowdiness

Root cause

Static semantics for AssignmentTargetType (§13.1.2) require a ReferenceError at runtime for certain left-hand-side expressions that are syntactically valid but semantically invalid assignment targets (e.g., evaluated-not-simple patterns). The engine currently emits SyntaxError at parse time instead, or emits no error at all.

Affected patterns include: certain parenthesized expressions, destructuring covers, and for-in LHS patterns.

Failure breakdown — language/expressions suite (2026-06-21)

Failure type Count
Expected ReferenceError, got SyntaxError 3
Expected exception, got none 3
Invalid assignment target (parse error) 1
Total 7 unique files

Fix direction

Distinguish between syntactically invalid LHS (emit SyntaxError at parse time) and semantically invalid LHS that is only invalid at assignment time (emit ReferenceError at runtime). The spec splits these between static semantics (§13.1.2 AssignmentTargetType = invalid → parse error) and runtime semantics (evaluate → target → throw).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconformanceECMAScript conformancetest262Test262 conformance work

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions