ECMA-262 in Lean

From docs/spec-issues/

Spec issues

49 write-ups of places where the text of ECMA-262 cannot be followed as written, or should say something else: 34 defects of the text, 2 proposed normative change, 9 editorial items and questions, and 4 defects the editors have since fixed. Each argues from the text alone.

How to read them

Each write-up names its clause and step in ECMA-262 at b1eaed82f (the pinned text; clause numbers and steps are its own, and links go to the living draft, which may differ), quotes the text, says what goes wrong, gives a small program where one shows it, proposes a change, and says what test262 (at 2e58f87d) tests. Every quotation of the text is checked against the pinned spec.html when this site is built, step numbers included. Where a write-up is about an erratum of the model, the Errata page has that erratum's readings and the program that shows it.

The examples are Scripts unless they are a directory, whose main.mjs is a Module. They were run on:

  • V8 (node): v24.18.1 (V8 13.6.233.17-node.50)
  • SpiderMonkey (js140): JavaScript-C140.13.0
  • JavaScriptCore (bun): Bun 1.3.13+bf2e2cecf (JavaScriptCore of oven-sh/WebKit 4d5e75ebd84a14edbc7ae264245dcd77fe597c10)
  • The formal model: ecma-run, built from this repository at the commit this site was built from.

The SpiderMonkey shell runs a Script file as it is; Node.js and Bun run it through a three-line shim that evaluates it with vm.runInThisContext, as a Script in the main realm. The examples' runs has every run's output. The proposed changes are proposals of this project, not of TC39: none of these write-ups has been filed with TC39.

Each write-up's Upstream item says what a check of tc39/ecma262 found on 2026-11-19, 2026-11-20: the issues and pull requests that report, fix or relate to the defect, with their state on that day, and the commits that changed the text. The Upstream column gives the first of them, or the fix. The record of the check is docs/spec-issues/upstream.tsv; the site's build does not use the network.

Defects of the text (34)

The text, read as written, gives no answer, an answer that contradicts another sentence, or an answer test262 does not accept. Each is an erratum of the model, with its readings on the Errata page.

No.Write-upClauseErratumUpstreamProgram
01Number::multiply gives +0 for +0 × -56.1.6.1.4 Number::multiplyNumberMultiplyZeroSignPR #4072 openyes
02GatherAvailableAncestors reads the [[CycleRoot]] of a module whose evaluation threw16.2.1.6.1.3.3 GatherAvailableAncestors and 1 moreGatherAvailableAncestorsEmptyCycleRootissue #3766 open, PR #3769 openyes
03A built-in async function's promise fulfils with undefined10.3.3 BuiltinCallOrConstruct and 1 moreBuiltinReturnCompletionPR #4074 openyes
04A module with top-level await never disposes its top-level resources16.2.1.7.3.2 ExecuteModuleExecuteModuleAsyncDisposeResourcesissue #4039 open, PR #4007 closed unmergedyes
05ParseText creates SyntaxError objects without a realm11.1.6 Static Semantics: ParseText and 2 moreParseTextErrorObjectsnone foundyes
06A synchronous Atomics.wait that times out returns "ok"25.4.3.14 DoWait and 2 moreDoWaitSyncTimeoutnone foundyes
09EnqueueAtomicsWaitAsyncTimeoutJob passes a negative delay, and its Assert can fail25.4.3.15 EnqueueAtomicsWaitAsyncTimeoutJob and 2 moreAtomicsWaitAsyncTimeoutAssert, AtomicsWaitAsyncTimeoutNegativeDelaynone foundyes
10new Date(0).setHours(1e21): UTC ( t ) reaches a failing Assert21.4.1.18 GetUTCEpochNanoseconds and 3 moreGetUTCEpochNanosecondsNaNPR #3464 openyes
11/u with lastIndex inside a surrogate pair: a match reported one code unit late, and a Match Record that ends before it starts22.2.7.2 RegExpBuiltinExec and 3 moreGetMatchStringStartAfterEndissue #128 open, issue #2511 openyes
12AsyncBlockStart asserts unused, but Await resumes it with empty27.10.5.2 AsyncBlockStart and 3 moreAsyncBlockStartAwaitResultissue #3435 openyes
13NewPromiseReactionJob returns the throw completion of a resolving function9.5 Jobs and Host Operations to Enqueue Jobs and 1 morePromiseJobAbruptCompletionnone foundyes
14Function.prototype.toString has no conforming result for some [[InitialName]] values20.2.3.5 Function.prototype.toString and 1 moreNativeFunctionInitialNamerelated: PR #2695 openyes
15A second Link of a Synthetic Module Record resets its exports, observably with JSON modules16.2.1.8.4.4 Link and 2 moreSyntheticModuleLinkResetsissue #3989 openyes
20new Function("o", "return o.#f"): no check of private names in dynamic functions20.2.1.1.1 CreateDynamicFunction and 1 moreCreateDynamicFunctionPrivateIdentifiersnone foundyes
23Races: "it is not the case that both" is always true29.8 Races and 2 moreRacesNotBothPR #4021 closed unmerged
24CompileToCharSet asks UnicodeMatchPropertyValue for a General_Category value before testing that it is one22.2.2.9 Runtime Semantics: CompileToCharSet and 1 moreLonePropertyGeneralCategoryAssertissue #3586 open, PR #3587 openyes
26Annex B: /(?ii:a)/ has no early error under §B.1.2B.1.2.1 Static Semantics: Early Errors and 3 moreAnnexBModifierEarlyErrorsnone foundyes
31Sort: a comparator that returns ±∞ is neither consistent nor inconsistent23.1.3.30.1 SortIndexedProperties and 3 moreSortInfiniteComparatornone foundyes
32Identifier early errors take the StringValue of a |ReservedWord|, which StringValue does not define13.1.1 Static Semantics: Early Errors and 2 moreStringValueReservedWordissue #1865 openyes
33CreateIntrinsics passes async in prefix's position: every built-in gets a Boolean prefix9.3.2 CreateIntrinsics and 3 moreCreateIntrinsicsAsyncArgumentissue #3534 open, issue #4046 openyes
35Contains never finds an |AwaitExpression|: async function f(x = await 1) {} has no early error8.5.1 Static Semantics: Contains and 1 moreContainsAwaitCovernone foundyes
36IsLabelledFunction tests a |Statement| node for being a |LabelledStatement|: always false14.13.2 Static Semantics: IsLabelledFunction and 4 moreUnitChainChildnone foundyes
37String.prototype.split with an empty separator builds an Array of code units22.1.3.23 String.prototype.split and 1 moreSplitCodeUnitStringsnone foundyes
40Annex B: what §B.1.2's ordered alternatives choose, and which |Pattern| its group-number condition countsB.1.2 Regular Expressions Patterns and 2 moreAnnexBRegExpOrder, AnnexBGroupCountPR #2445 openyes
41Annex B: a first-line --> is an input element that is neither a comment nor a tokenB.1.1 HTML-like Comments and 1 moreHTMLCloseCommentTokennone foundyes
43AllocateSharedArrayBuffer stores a growable buffer's length with SetValueInBuffer on a Shared Data Block25.2.2.1 AllocateSharedArrayBuffer and 1 moreAllocateSharedArrayBufferByteLengthStorePR #4023 closed unmergedyes
44Lookahead restrictions over an automatically inserted semicolon5.1.6.7 Lookahead Restrictions and 3 moreLookaheadSourceTokensnone foundyes
45FinalizationRegistry.prototype.unregister removes cells from the List it iterates26.2.3.3 FinalizationRegistry.prototype.unregisterUnregisterIteratesCopynone foundyes
46A covered Parse Node is outside the tree that covers it5.1.5 The Syntactic Grammar and 4 moreCoveredNodeParentnone foundyes
48happens-before orders an init write only before events with overlapping ranges, which excludes the equal range of a 1-byte access29.6.6 happens-before and 8 moreInitHappensBeforeOverlapnone found
49Annex B: /[\c1-\c5]/ asks for the IsCharacterClass of ClassEscape :: c ClassControlLetter, which has noneB.1.2 Regular Expressions Patterns and 4 moreIsCharacterClassControlLetternone found
50reads-bytes-from and coherent reads ask only for a byte index in a memory range, which names no [[Block]]29.1 Memory Model Fundamentals and 2 moreMemoryRangeSameBlocknone found
52Static Semantics: MV has a row for DecimalIntegerLiteral :: `0`, a production the grammar does not have12.9.3 Numeric Literals and 1 moreMVDecimalIntegerLiteralZeronone found
53Maximum String length is unspecified and leaves "a".repeat(2 ** 30) exact up to 2^53 - 16.1.4 The String Type and 5 moreStringMaximumLengthnone found

A proposed normative change (2)

Not a defect: the text is consistent, and the change would alter what it requires.

Editorial items and questions (9)

Irregular notation, a missing case nothing observable depends on, or a sentence that needs clarifying. The model reads the text there without an erratum.

Fixed in the pinned text (4)

Defects the editors have since fixed: the pinned text no longer has them, and the model's errata for them are retired. Each write-up keeps the argument as a record.

No.Write-upClauseErratumUpstreamProgram
07TypedArray with and filter assert that a BigInt store of undefined succeeds23.2.3.10 %TypedArray%.prototype.filter and 3 moreTypedArrayWithSetElementAbrupt (retired), TypedArrayFilterKeptUndefined (retired)fixed: PR #3979 mergedyes
08Object.create(null) == false: IsLooselyEqual asserts that ToPrimitive succeeds7.2.13 IsLooselyEqual and 1 moreIsLooselyEqualBooleanAbrupt (retired)fixed: PR #4067 mergedyes
22reads-bytes-from names an unbound _result_29.6.2 reads-bytes-fromReadsBytesFromUnboundResult (retired)fixed: PR #4064 merged
34RevalidateAtomicAccess checks only the element's first byte, and the buffer operation's Assert fails25.4.3.4 RevalidateAtomicAccess and 6 moreRevalidateAtomicAccess (retired)fixed: PR #3926 mergedyes