Problem
A 66-case differential over class, private-name, super, TDZ, Promise, async and
iterator errors matches 34/66. Two clusters account for most of it.
Class early errors have no prose at all (8 cases)
Duplicate private name, undeclared private name, a private name outside a class,
delete this.#x, await in a static block, a field named constructor,
#constructor, and super outside a method all collapse to the SAME string:
eval: UnexpectedToken at <line>:<col>.
Two structural problems: there is no per-rule message, so eight distinct spec early
errors are indistinguishable; and the string carries an eval: prefix and a line:col
that JavaScriptCore never puts in .message. This is the class-specific face of #899 —
fixing #899's reason-discriminant mechanism should cover these, and they are a good
first set of rules to carry through it since the parser already detects each one
correctly at the right offset.
Private-name runtime messages need a split AND a merge (6 cases)
JavaScriptCore splits by what the private name IS, where zig-js uses one string:
| brand missing on | JavaScriptCore |
|---|---|
| a field | Cannot access invalid private field |
| a method or accessor | Cannot access private method or acessor |
Note JSC's own typo — one c in "acessor". Exact parity requires reproducing it.
In the other direction zig-js is more specific than JSC, and matching means merging.
For a present brand with a missing accessor half, JSC uses two fixed strings —
Trying to access an undefined private getter / ... private setter — and uses the
setter string even for writing a private method. zig-js emits three more
descriptive strings (Cannot write private method, Cannot write private member:
accessor has no setter, Cannot read private member: accessor has no getter).
That merge loses information, so it is a deliberate call rather than an obvious fix: worth confirming that Home/Bun code actually matches on these before giving up the more useful wording.
Verification
scratchpad/sweep/probe.sh, against a real JavaScriptCore backend.