Each erratum names the sentences of the text it is about, quoted from the pinned spec.html (a step or a rule is found by the hash the overlay records of its text, so a change to the text fails the build), and the readings the overlay holds: the literal text, the sentence as written; the test262 reading, the one test262's tests require; the proposed reading, the text proposed in its place. Where two readings have the same text, it is given once. The notes are the overlay's own.
Of the 38 errata, 21 are read by default as test262 requires, 12 as written and 5 as proposed. 29 are switched in the specification at run time, 5 only in the engine's parser, and 4 have one reading.
29 errata have a program that shows them. Each program was run when this site was built, 59 runs in all on the native ecma-run, under its erratum's default reading and under its other reading (the literal text, or, where the default is the literal text, the proposed or test262 reading), and printed what the page says. An object's number in a result line is written #N.
Places where the text, read as written, gives no answer, an answer that contradicts another sentence, or an answer test262 does not accept.
default: test262switched: spec
Write-up 36. IsLabelledFunction tests a Statement node for being a LabelledStatement: always false
§14.13.2 Static Semantics: IsLabelledFunction, steps 1 and 2If stmt is not a LabelledStatement, return false. … Let item be the LabelledItem of stmt.
The overlay's note
"the X of n" names a child of n (§5.1.2 gives a node only its right-hand side's children), so IsLabelledFunction 1-2 never find the LabelledStatement under a Statement node: read by §5.1.2 alone, step 1 returns false for every Statement node and if (1) l: function f() {} is valid; test262's labelled-fn-stmt*.js require a SyntaxError. The model reads "n is a X" through the unit chain, so its literal reading passes step 1 and stops (a sort error) at step 2, where n's production has no X. The test262 and proposed reading: X is taken from the first node of n's unit chain whose production has one.
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum UnitChainChild=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
default: test262switched: spec
Write-up 32. Identifier early errors take the StringValue of a ReservedWord, which StringValue does not define
§13.1.1 Static Semantics: Early Errors, the early-error rule of Identifier : IdentifierName but not ReservedWordIt is a Syntax Error if the StringValue of IdentifierName is the StringValue of any ReservedWord except for yield or await.
- The test262 and proposed readings
It is a Syntax Error if the StringValue of IdentifierName is the String value of any terminal of ReservedWord except for yield or await.
The overlay's note
"the StringValue of any ReservedWord except for yield or await" takes the StringValue of a ReservedWord, for which StringValue has no row. The literal text stops there. The test262 and proposed reading: the StringValue of a terminal is the String value of its code points (test262's val--via-escape-.js require a SyntaxError for an IdentifierName that spells a reserved word with escapes).
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum StringValueReservedWord=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/erratum_stringvalue_reserved_word.js, run as ecma-run tests/run/erratum_stringvalue_reserved_word.js with the option of each row:
The test262 reading (the default)
--erratum StringValueReservedWord=test262 | throw: SyntaxError |
|---|
The literal text
--erratum StringValueReservedWord=literal | stop: sortError ph-stringvalue-any-nt-except#0 1: stops at ph-stringvalue-any-nt-except (a reading of the overlay), step 1 (a value of the wrong sort reaches the step) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// An |IdentifierName| spelling `if` with an escape is the String value of a
// terminal of |ReservedWord| (Erratum StringValueReservedWord, test262's reading).
// expect: throw: SyntaxError
var \u0069f;
default: test262switched: parser
Write-up 44. Lookahead restrictions over an automatically inserted semicolon
§5.1.6.7 Lookahead RestrictionsIf the phrase “[lookahead = seq]” appears in the right-hand side of a production, it indicates that the production may only be used if the token sequence seq is a prefix of the immediately following input token sequence.
§12.10 Automatic Semicolon InsertionThese situations are described by saying that semicolons are automatically inserted into the source code token stream in those situations.
The overlay's note
A lookahead restriction reads "the immediately following input token sequence" (§5.1.6.7), and §12.10 inserts semicolons "into the source code token stream": the text does not say whether an inserted semicolon is a token a lookahead reads. Read as one, if (0) let LF [a] = 0; is a sentence. The literal text stops wherever a lookahead reads at an inserted semicolon. The test262 and proposed reading: a lookahead reads the source's tokens, past the semicolons §12.10 inserted (test262's let-array-with-newline.js require a SyntaxError).
- Default
- The test262 reading.
- Switched
- Only in the engine's parser. The specification's grammar (
lean/Ecma/Grammar/Gen) has the default reading; the engine's parser has both, and ecma-run --erratum LookaheadSourceTokens=literal parses as the text is written. The literal reading is the engine's parser's, not the specification layer's.
The program tests/run/erratum_lookahead_source_tokens.js, run as ecma-run tests/run/erratum_lookahead_source_tokens.js with the option of each row:
The test262 reading (the default)
--erratum LookaheadSourceTokens=test262 | throw: SyntaxError |
|---|
The literal text
--erratum LookaheadSourceTokens=literal | stop: residue formal-parsetextin#0 2: stops at formal-parsetextin (a reading of the overlay), step 2 (a step of the text with no reading the machine can run) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// The inserted `;` after `let` is no source token: ExpressionStatement's lookahead
// reads `let [` and the program has no parse (Erratum LookaheadSourceTokens,
// test262's reading).
// expect: throw: SyntaxError
if (0) let
[a] = 0;
default: test262switched: parser
Write-up 40. Annex B: what §B.1.2's ordered alternatives choose, and which Pattern its group-number condition counts
§B.1.2 Regular Expressions PatternsWhen parsing using the following grammar, each alternative is considered only if previous production alternatives do not match.
The overlay's note
B.1.2's "each alternative is considered only if previous production alternatives do not match" says neither what an alternative matches nor how nested choices combine, and without an order its grammar is ambiguous (/a{1}/, /\b*/, /\1/). The literal text stops on a pattern with more than one parse. The test262 and proposed reading: commitment: a node of a nonterminal B.1.2 restates uses an alternative only if no earlier alternative of it derives any span from the node's start (tc39/ecma262 #2228; test262's annexB/built-ins/RegExp).
- Default
- The test262 reading.
- Switched
- Only in the engine's parser. The specification's grammar (
lean/Ecma/Grammar/Gen) has the default reading; the engine's parser has both, and ecma-run --erratum AnnexBRegExpOrder=literal parses as the text is written. The literal reading is the engine's parser's, not the specification layer's.
The program tests/run/erratum_annexb_regexp_order.js, run as ecma-run --annex-b sec-regular-expressions-patterns tests/run/erratum_annexb_regexp_order.js with the option of each row:
The test262 reading (the default)
--erratum AnnexBRegExpOrder=test262 | throw: SyntaxError |
|---|
The literal text
--erratum AnnexBRegExpOrder=literal | stop: residue formal-parsetextin#0 2: stops at formal-parsetextin (a reading of the overlay), step 2 (a step of the text with no reading the machine can run) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// B.1.2's alternatives commit in order: `\b*` is an Assertion, which no
// quantifier follows, and the literal has no parse (Erratum AnnexBRegExpOrder,
// test262's reading).
// args: --annex-b sec-regular-expressions-patterns
// expect: throw: SyntaxError
/\b*/;
default: test262switched: parser
Write-up 40. Annex B: what §B.1.2's ordered alternatives choose, and which Pattern its group-number condition counts
§B.1.2 Regular Expressions Patterns, the condition on AtomEscape :: DecimalEscape[~UnicodeMode] DecimalEscape [> but only if the CapturingGroupNumber of DecimalEscape is ≤ CountLeftCapturingParensWithin(the Pattern containing DecimalEscape)]
The overlay's note
B.1.2's condition on AtomEscape :: DecimalEscape, "the CapturingGroupNumber of DecimalEscape is ≤ CountLeftCapturingParensWithin(the Pattern containing DecimalEscape)", reads the Pattern whose parse the condition itself decides. The literal text stops on a pattern with more than one parse. The test262 and proposed reading: stratified: the count is that of a committed parse of the input as Pattern[~UnicodeMode, ~UnicodeSetsMode, ~NamedCaptureGroups] with the condition true (test262's legacy-octal-escape.js).
- Default
- The test262 reading.
- Switched
- Only in the engine's parser. The specification's grammar (
lean/Ecma/Grammar/Gen) has the default reading; the engine's parser has both, and ecma-run --erratum AnnexBGroupCount=literal parses as the text is written. The literal reading is the engine's parser's, not the specification layer's.
The program tests/run/erratum_annexb_group_count.js, run as ecma-run --annex-b sec-regular-expressions-patterns tests/run/erratum_annexb_group_count.js with the option of each row:
The test262 reading (the default)
--erratum AnnexBGroupCount=test262 | normal: true |
|---|
The literal text
--erratum AnnexBGroupCount=literal | stop: residue formal-parsetextin#0 2: stops at formal-parsetextin (a reading of the overlay), step 2 (a step of the text with no reading the machine can run) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// `\1` with one capturing group is a backreference: the group count is read
// from a committed parse (Erratum AnnexBGroupCount, test262's reading).
// args: --annex-b sec-regular-expressions-patterns
// expect: normal: true
/(a)\1/.test("aa");
default: test262switched: spec
Write-up 26. Annex B: /(?ii:a)/ has no early error under §B.1.2
§22.2.1.1 Static Semantics: Early Errors, the early-error rule of Atom :: `(?` RegularExpressionModifiers `:` Disjunction `)`It is a Syntax Error if the source text matched by RegularExpressionModifiers contains the same code point more than once.
- The test262 and proposed readings
It is a Syntax Error if the source text matched by RegularExpressionModifiers contains the same code point more than once.
§22.2.1.1 Static Semantics: Early Errors, the early-error rule of Atom :: `(?` RegularExpressionModifiers `-` RegularExpressionModifiers `:` Disjunction `)`It is a Syntax Error if the source text matched by the first RegularExpressionModifiers and the source text matched by the second RegularExpressionModifiers are both empty.
- The test262 and proposed readings
It is a Syntax Error if the source text matched by the first RegularExpressionModifiers and the source text matched by the second RegularExpressionModifiers are both empty.
§22.2.1.1 Static Semantics: Early Errors, the early-error rule of Atom :: `(?` RegularExpressionModifiers `-` RegularExpressionModifiers `:` Disjunction `)`It is a Syntax Error if the source text matched by the first RegularExpressionModifiers contains the same code point more than once.
- The test262 and proposed readings
It is a Syntax Error if the source text matched by the first RegularExpressionModifiers contains the same code point more than once.
§22.2.1.1 Static Semantics: Early Errors, the early-error rule of Atom :: `(?` RegularExpressionModifiers `-` RegularExpressionModifiers `:` Disjunction `)`It is a Syntax Error if the source text matched by the second RegularExpressionModifiers contains the same code point more than once.
- The test262 and proposed readings
It is a Syntax Error if the source text matched by the second RegularExpressionModifiers contains the same code point more than once.
§22.2.1.1 Static Semantics: Early Errors, the early-error rule of Atom :: `(?` RegularExpressionModifiers `-` RegularExpressionModifiers `:` Disjunction `)`It is a Syntax Error if any code point in the source text matched by the first RegularExpressionModifiers is also contained in the source text matched by the second RegularExpressionModifiers.
- The test262 and proposed readings
It is a Syntax Error if any code point in the source text matched by the first RegularExpressionModifiers is also contained in the source text matched by the second RegularExpressionModifiers.
The overlay's note
§22.2.1.1's modifier rules are on Atom's productions; under B.1.2's grammar (?ii:a) is an ExtendedAtom, for which B.1.2.1 adds no such rule, so literally /(?ii:a)/, /(?-:a)/ and /(?i-i:a)/ are valid patterns without the u or v flag on a B.1.2 host. The test262 and proposed reading: §22.2.1.1's rules of the two modifier productions of Atom apply to the ExtendedAtom productions with the same right-hand sides.
- Read as written
- The text never stops a run.
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum AnnexBModifierEarlyErrors=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/erratum_annexb_modifier_early_errors.js, run as ecma-run --annex-b sec-regular-expressions-patterns tests/run/erratum_annexb_modifier_early_errors.js with the option of each row:
The test262 reading (the default)
--erratum AnnexBModifierEarlyErrors=test262 | throw: SyntaxError |
|---|
The literal text
--erratum AnnexBModifierEarlyErrors=literal | normal: [object #N] |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// §22.2.1.1's modifier rules hold on B.1.2's ExtendedAtom: `(?ii:a)` repeats a
// modifier (Erratum AnnexBModifierEarlyErrors, test262's reading).
// args: --annex-b sec-regular-expressions-patterns
// expect: throw: SyntaxError
/(?ii:a)/;
default: test262switched: parser
Write-up 46. A covered Parse Node is outside the tree that covers it
§5.1.5 The Syntactic GrammarThe sequence of tokens originally matched by p is parsed again using n as the goal symbol.
§15.10.1 Static Semantics: IsInTailPosition, step 2Let body be the FunctionBody, ConciseBody, or AsyncConciseBody that most closely contains call.
The overlay's note
§5.1.5 reparses a cover with n as goal, so the covered node roots a tree of its own: "contained within", "most closely contains" and "the parent of" (IsInTailPosition 2, MightBothParticipate 1, ShallowestContainedJSONValue 6.d) fail for a node inside it, and read literally return (f(n - 1)) is no tail call. The test262 and proposed reading: the covered node takes the cover's place in the tree, its parent being the cover's parent (test262's tco-pos.js).
- Read as written
- The text never stops a run.
- Default
- The test262 reading.
- Switched
- Only in the engine's parser. The specification's grammar (
lean/Ecma/Grammar/Gen) has the default reading; the engine's parser has both, and ecma-run --erratum CoveredNodeParent=literal parses as the text is written. The literal reading is the engine's parser's, not the specification layer's.
The program tests/run/erratum_covered_node_parent.js, run as ecma-run tests/run/erratum_covered_node_parent.js with the option of each row:
The test262 reading (the default)
--erratum CoveredNodeParent=test262 | normal: 0 |
|---|
The literal text
--erratum CoveredNodeParent=literal | stop: residue sec-grouping-operator-static-semantics-early-errors#0 ?: stops at §13.2.9.1 Static Semantics: Early Errors (a step of the text with no reading the machine can run) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// Erratum CoveredNodeParent at its test262 reading: the covered
// |ParenthesizedExpression| takes its cover's place, so `return (f(n - 1))` is
// in tail position (test262 tco-pos.js).
// expect: normal: 0
"use strict";
function f(n) {
if (n === 0) return 0;
return (f(n - 1));
}
f(3);
default: proposedswitched: spec
Write-up 01. Number::multiply gives +0 for +0 × -5
§6.1.6.1.4 Number::multiply, step 6Return 𝔽(ℝ(x) × ℝ(y)).
- The proposed reading
- If x is +0𝔽 and y < -0𝔽, return -0𝔽.
- If y is +0𝔽 and x < -0𝔽, return -0𝔽.
- Return 𝔽(ℝ(x) × ℝ(y)).
- Default
- The proposed reading. The overlay's resolution is
pending: not yet decided; the machine runs the proposed reading until it is. - Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum NumberMultiplyZeroSign=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
The program tests/run/number_multiply_zero_sign.js, run as ecma-run tests/run/number_multiply_zero_sign.js with the option of each row:
The proposed reading (the default)
--erratum NumberMultiplyZeroSign=proposed | normal: undefined-Infinity,-Infinity,Infinity,-Infinity,Infinity,Infinity,-Infinity
|
|---|
The literal text
--erratum NumberMultiplyZeroSign=literal | normal: undefinedInfinity,Infinity,Infinity,-Infinity,Infinity,Infinity,-Infinity
|
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text Open in the debugger: The literal text
Source
// expect: normal: undefined
// print: -Infinity,-Infinity,Infinity,-Infinity,Infinity,Infinity,-Infinity
// Number::multiply step 6 gives 𝔽(0) = +0 for +0 × -5; the clause's
// description (IEEE 754-2019) and every engine give -0 (Erratum
// NumberMultiplyZeroSign, read by default as proposed: no test262 assertion
// covers the case). A product that underflows keeps
// its sign by 𝔽 itself.
print(String([1 / (0 * -5), 1 / (-5 * 0), 1 / (0 * 5), 1 / (-0 * 5), 1 / (-0 * -5), 1 / (0 * 0),
1 / (1e-300 * -1e-300)]));
default: literalswitched: spec
Write-up 02. GatherAvailableAncestors reads the [[CycleRoot]] of a module whose evaluation threw
§16.2.1.6.1.3.3 GatherAvailableAncestors, step 1.aIf execList does not contain ancestorModule and ancestorModule.[[CycleRoot]].[[EvaluationError]] is empty, then
- The proposed reading
- If execList does not contain ancestorModule and ancestorModule.[[EvaluationError]] is empty, then
- Assert: ancestorModule.[[Status]] is evaluating-async.
- Assert: ancestorModule.[[CycleRoot]] is not empty.
- If ancestorModule.[[CycleRoot]].[[EvaluationError]] is empty, then
- Assert: ancestorModule.[[AsyncEvaluationOrder]] is an integer.
- Assert: ancestorModule.[[PendingAsyncDependencies]] > 0.
- Set ancestorModule.[[PendingAsyncDependencies]] to ancestorModule.[[PendingAsyncDependencies]] - 1.
- If ancestorModule.[[PendingAsyncDependencies]] = 0, then
- Append ancestorModule to execList.
- If ancestorModule.[[HasTLA]] is false, perform GatherAvailableAncestors(ancestorModule, execList).
- Read as written
- A run stops at §16.2.1.6.1.3.3 GatherAvailableAncestors, step 1.a.
- Default
- The literal text.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum GatherAvailableAncestorsEmptyCycleRoot=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
The program tests/run/module_erratum_cycle_root.js, run as ecma-run --module --module-dir tests/run/modules tests/run/module_erratum_cycle_root.js with the option of each row:
The literal text (the default)
--erratum GatherAvailableAncestorsEmptyCycleRoot=literal | stop: erratum GatherAvailableAncestorsEmptyCycleRoot sec-gather-available-ancestors#0 1.a: stops at §16.2.1.6.1.3.3 GatherAvailableAncestors, step 1.a (the step this erratum names) |
|---|
The proposed reading
--erratum GatherAvailableAncestorsEmptyCycleRoot=proposed | throw: Error: c |
|---|
Source
// module: yes
// args: --module-dir tests/run/modules
// expect: stop: erratum GatherAvailableAncestorsEmptyCycleRoot sec-gather-available-ancestors#0 1.a
// A module whose synchronous evaluation threw has no [[CycleRoot]] (Evaluate
// step 9.a). When its async dependency b finishes, GatherAvailableAncestors
// step 1.a reads a.[[CycleRoot]].[[EvaluationError]], a field of ~empty~: the
// pinned text has no result there (docs/spec-issues/02). No test262 test
// builds this graph, so the defect is kept literal (Erratum
// GatherAvailableAncestorsEmptyCycleRoot) and the run stops, naming it
// (`stop: erratum <Name> <site>`, exit 3: Engine/Cli/Run.lean). The proposed
// reading skips an ancestor whose [[EvaluationError]] is set: b runs to its
// end and c's error is the outcome (`--erratum
// GatherAvailableAncestorsEmptyCycleRoot=proposed`: `throw: Error: c`, then b).
import "./f22_a.mjs";
default: test262switched: spec
Write-up 03. A built-in async function's promise fulfils with undefined
§10.3.3 BuiltinCallOrConstruct, step 10.b.iiiReturn Completion(result).
- The test262 and proposed readings
- If result is a normal completion, return ReturnCompletion(result.[[Value]]).
- Return ? result.
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum BuiltinReturnCompletion=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/builtin_async_return.js, run as ecma-run tests/run/builtin_async_return.js with the option of each row:
The test262 reading (the default)
--erratum BuiltinReturnCompletion=test262 | normal: undefined |
|---|
The literal text
--erratum BuiltinReturnCompletion=literal | normal: undefined |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// expect: normal: undefined
// print: undefined
// print: 1,2
// BuiltinCallOrConstruct step 10.b.iii under Erratum BuiltinReturnCompletion
// (its test262 reading): "Return array" of Array.fromAsync is a normal
// completion, which the resultsClosure gives to AsyncBlockStart as a return
// completion, so the promise is fulfilled with the array; disposeAsync's
// "Return ? DisposeResources(…)" fulfils it with undefined.
Array.fromAsync([1, 2]).then(function (a) { print(a.join(",")); });
new AsyncDisposableStack().disposeAsync().then(function (v) { print(String(v)); });
void 0;
default: test262switched: spec
Write-up 04. A module with top-level await never disposes its top-level resources
§16.2.1.7.3.2 ExecuteModule, step 4.bPerform AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleContext).
- The test262 and proposed readings
- Let env be module.[[Environment]].
- Let asyncBody be a new Abstract Closure with no parameters that captures module and env and performs the following steps when called:
- Let result be Completion(Evaluation of module.[[ECMAScriptCode]]).
- Set result to Completion(DisposeResources(env.[[DisposableResourceStack]], result)).
- Return Completion(result).
- Perform AsyncBlockStart(capability, asyncBody, moduleContext).
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum ExecuteModuleAsyncDisposeResources=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/errata_execute_module_dispose.js, run as ecma-run --module tests/run/errata_execute_module_dispose.js with the option of each row:
The test262 reading (the default)
--erratum ExecuteModuleAsyncDisposeResources=test262 | normal: undefined |
|---|
The literal text
--erratum ExecuteModuleAsyncDisposeResources=literal | normal: undefined |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// module: yes
// expect: normal: undefined
// print: end
// print: disposed
// A module with top-level await and `await using` (Erratum ExecuteModuleAsyncDisposeResources):
// the test262 reading disposes the module's resources after its body.
await using x = { [Symbol.asyncDispose]() { print("disposed"); } };
await 0;
print("end");
default: literalswitched: spec
Write-up 05. ParseText creates SyntaxError objects without a realm
§11.1.6 Static Semantics: ParseText, step 5Return a List of one or more SyntaxError objects representing the parsing errors and/or early errors. If more than one parsing error or early error is present, the number and ordering of error objects in the list is implementation-defined, but at least one must be present.
- The proposed reading
- Return « a newly created SyntaxError object ».
§22.2.3.4 Static Semantics: ParsePattern, step 1.aLet parseResult be a List containing one or more SyntaxError objects.
- The proposed reading
- Let parseResult be « a newly created SyntaxError object ».
§B.1.2.9 Static Semantics: ParsePattern, step 1.aLet parseResult be a List containing one or more SyntaxError objects.
- The proposed reading
- Let parseResult be « a newly created SyntaxError object ».
The overlay's note
The pinned text says ParseText and ParsePattern return "a List of one or more SyntaxError objects" (with an implementation-defined number and order when multiple errors exist), without specifying the Realm Record or concrete error objects. Every caller only checks whether the List is non-empty and throws a fresh SyntaxError of its own (or, for ParseScript/ParseModule hosts, takes an element), so the proposed reading returns a single newly created SyntaxError object in the current realm (write-up 05).
- Read as written
- The text never stops a run.
- Default
- The literal text.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum ParseTextErrorObjects=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
No program on this site shows this erratum.
default: test262switched: spec
Write-up 06. A synchronous Atomics.wait that times out returns "ok"
§25.4.3.14 DoWait, step 28.aPerform SuspendThisAgent(waiterList, waiterRecord).
- The test262 reading
- Perform SuspendThisAgent(waiterList, waiterRecord).
- If waiterList.[[Waiters]] contains waiterRecord, then
- Set waiterRecord.[[Result]] to "timed-out".
- Perform RemoveWaiter(waiterList, waiterRecord).
- The proposed reading
- Perform SuspendThisAgent(waiterList, waiterRecord).
- If waiterList.[[Waiters]] contains waiterRecord, then
- NOTE: The agent woke because of the timeout: NotifyWaiter is performed only on a Waiter Record that RemoveWaiters has removed.
- Set waiterRecord.[[Result]] to "timed-out".
- Perform RemoveWaiter(waiterList, waiterRecord).
- Read as written
- A run stops at §25.4.3.8 AddWaiter, step 2.
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum DoWaitSyncTimeout=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/atomics_wait_sync_timeout.js, run as ecma-run --can-block tests/run/atomics_wait_sync_timeout.js with the option of each row:
The test262 reading (the default)
--erratum DoWaitSyncTimeout=test262 | normal: undefinedtimed-out,timed-out,true,true,0 ; not-equal
|
|---|
The literal text
--erratum DoWaitSyncTimeout=literal | stop: erratum DoWaitSyncTimeout sec-addwaiter#0 2: stops at §25.4.3.8 AddWaiter, step 2 (the step this erratum names) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text Open in the debugger: The literal text
Source
// Atomics.wait on an agent that can block (§25.4.3.14, SuspendThisAgent
// §25.4.3.11): with one agent nothing notifies the waiter, so it wakes when
// the host's clock reaches its timeout time. Erratum DoWaitSyncTimeout: the
// woken waiter's [[Result]] is "timed-out" and it leaves the WaiterList, so a
// second wait on the same location does not fail AddWaiter step 2's Assert
// and a later Atomics.notify finds no waiter.
// args: --can-block
// expect: normal: undefined
// print: timed-out,timed-out,true,true,0 ; not-equal
var i32 = new Int32Array(new SharedArrayBuffer(8));
var t0 = Date.now();
var first = Atomics.wait(i32, 0, 0, 10);
var t1 = Date.now();
var second = Atomics.wait(i32, 0, 0, 5);
var t2 = Date.now();
var notified = Atomics.notify(i32, 0);
Atomics.store(i32, 1, 3);
print([first, second, t1 - t0 >= 10, t2 - t1 >= 5, notified].join() + " ; " + Atomics.wait(i32, 1, 0, 10));
void 0;
default: literalswitched: spec
Write-up 09. EnqueueAtomicsWaitAsyncTimeoutJob passes a negative delay, and its Assert can fail
§25.4.3.15 EnqueueAtomicsWaitAsyncTimeoutJob, step 1.b.iiAssert: ℝ(timeOfJobExecution) ≥ waiterRecord.[[TimeoutTime]] (ignoring potential non-monotonicity of time values).
- The proposed reading
- Assert: timeOfJobExecution ≥ 𝔽(waiterRecord.[[TimeoutTime]]) rounded down to an integral Number (ignoring potential non-monotonicity of time values).
- Read as written
- A run stops at §25.4.3.15 EnqueueAtomicsWaitAsyncTimeoutJob, step 1.b.ii.
- Default
- The literal text.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum AtomicsWaitAsyncTimeoutAssert=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
No program on this site shows this erratum.
default: literalswitched: spec
Write-up 09. EnqueueAtomicsWaitAsyncTimeoutJob passes a negative delay, and its Assert can fail
§25.4.3.15 EnqueueAtomicsWaitAsyncTimeoutJob, step 4Perform HostEnqueueTimeoutJob(timeoutJob, currentRealm, 𝔽(waiterRecord.[[TimeoutTime]]) - now).
- The proposed reading
- Let delay be 𝔽(waiterRecord.[[TimeoutTime]]) - now.
- If delay < +0𝔽, set delay to +0𝔽.
- Perform HostEnqueueTimeoutJob(timeoutJob, currentRealm, delay).
The overlay's note
now is read after DoWait's reading from which [[TimeoutTime]] was computed, so the literal difference is negative when the clock has advanced past [[TimeoutTime]], and HostEnqueueTimeoutJob takes a non-negative finite Number. The proposed reading clamps the text's own difference at zero, so that now + delay is 𝔽([[TimeoutTime]]) whenever the delay is positive: the Job runs no earlier than that time value, which is what AtomicsWaitAsyncTimeoutAssert's proposed Assert needs. Clamping the exact difference instead (𝔽(max([[TimeoutTime]] - ℝ(now), 0))) can round the delay down across a millisecond that 𝔽([[TimeoutTime]]) rounds up to.
- Read as written
- A run stops at §25.4.3.15 EnqueueAtomicsWaitAsyncTimeoutJob, step 4.
- Default
- The literal text.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum AtomicsWaitAsyncTimeoutNegativeDelay=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
No program on this site shows this erratum.
default: literalswitched: spec
Write-up 10. new Date(0).setHours(1e21): UTC ( t ) reaches a failing Assert
§21.4.1.26 UTC, step 1If t is not a finite Number, return NaN.
- The proposed reading
- If t is not a finite Number, return NaN.
- If MakeDay(𝔽(YearFromTime(t)), 𝔽(MonthFromTime(t)), 1𝔽) is NaN, return NaN.
- Read as written
- A run stops at §21.4.1.18 GetUTCEpochNanoseconds, step 4.
- Default
- The literal text.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum GetUTCEpochNanosecondsNaN=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
The program tests/run/date_utc_large_local_time.js, run as ecma-run tests/run/date_utc_large_local_time.js with the option of each row:
The literal text (the default)
--erratum GetUTCEpochNanosecondsNaN=literal | stop: erratum GetUTCEpochNanosecondsNaN sec-getutcepochnanoseconds#0 4: stops at §21.4.1.18 GetUTCEpochNanoseconds, step 4 (the step this erratum names) |
|---|
The proposed reading
--erratum GetUTCEpochNanosecondsNaN=proposed | normal: undefined |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the proposed reading Open in the debugger: The literal text
Source
// expect: stop: erratum GetUTCEpochNanosecondsNaN sec-getutcepochnanoseconds#0 4
// UTC ( t ) of a large finite local time: setHours(1e21) gives t = 3.6e24,
// GetUTCEpochNanoseconds step 1's MakeDay finds no time value on the month's
// first day (NaN), and the Assert of its step 4 fails. No test262 test
// reaches it, and the default reading is the text as written (Erratum
// GetUTCEpochNanosecondsNaN), so the run stops.
// Engines give NaN. The UTC setter does not call UTC ( t ): NaN.
print(String(new Date(0).setUTCHours(1e21)));
print(String(new Date(0).setHours(1e21)));
default: literalswitched: spec
Write-up 11. /u with lastIndex inside a surrogate pair: a match reported one code unit late, and a Match Record that ends before it starts
§22.2.7.2 RegExpBuiltinExec, step 13.bLet inputIndex be the index into input of the character that was obtained from element lastIndex of string.
- The proposed reading
- Let inputIndex be the index into input of the character that was obtained from element lastIndex of string.
- If fullUnicode is true, set lastIndex to GetStringIndex(string, inputIndex).
- Read as written
- A run stops at §22.2.7.6 GetMatchString, step 1, when called from §22.2.7.2 RegExpBuiltinExec.
- Default
- The literal text.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum GetMatchStringStartAfterEnd=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
The program tests/run/regexp_lastindex_inside_pair.js, run as ecma-run tests/run/regexp_lastindex_inside_pair.js with the option of each row:
The literal text (the default)
--erratum GetMatchStringStartAfterEnd=literal | stop: erratum GetMatchStringStartAfterEnd sec-getmatchstring#0 1: stops at §22.2.7.6 GetMatchString, step 1 (the step this erratum names) |
|---|
The proposed reading
--erratum GetMatchStringStartAfterEnd=proposed | normal: [object #N] |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the proposed reading Open in the debugger: The literal text
Source
// expect: stop: erratum GetMatchStringStartAfterEnd sec-getmatchstring#0 1
// RegExpBuiltinExec with /u and lastIndex on the trailing surrogate of a pair:
// step 13.b starts at the code point that contains it, the empty pattern
// matches there with [[EndIndex]] 0, and step 24's Match Record { 1, 0 } fails
// GetMatchString step 1's Assert. No test262 test sets lastIndex inside a
// pair before an empty match; the default reading is the text as written
// (Erratum GetMatchStringStartAfterEnd), so the run stops.
// V8 and SpiderMonkey report index 0; JavaScriptCore reports index 1.
// (The non-empty case, which does not stop, is
// regexp_lastindex_inside_pair_nonempty.js.)
var r = /(?:)/gu;
r.lastIndex = 1;
r.exec("\u{1F600}");
default: test262switched: spec
Write-up 12. AsyncBlockStart asserts unused, but Await resumes it with empty
§27.10.5.2 AsyncBlockStart, step 4Assert: result is unused.
- The test262 and proposed readings
- Assert: result is either unused or empty.
- Read as written
- A run stops at §27.10.5.2 AsyncBlockStart, step 4.
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum AsyncBlockStartAwaitResult=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
default: literalswitched: spec
Write-up 13. NewPromiseReactionJob returns the throw completion of a resolving function
§27.5.2.1 NewPromiseReactionJob, step 1.hIf handlerResult is an abrupt completion, then
- The proposed reading
- If handlerResult is an abrupt completion, then
- Let settleResult be Completion(Call(promiseCapability.[[Reject]], undefined, « handlerResult.[[Value]] »)).
- Else,
- Let settleResult be Completion(Call(promiseCapability.[[Resolve]], undefined, « handlerResult.[[Value]] »)).
§27.5.2.1 NewPromiseReactionJob, step 1.iReturn ? Call(promiseCapability.[[Resolve]], undefined, « handlerResult.[[Value]] »).
- The proposed reading
- If settleResult is an abrupt completion, perform HostReportErrors(« settleResult.[[Value]] »).
- Return empty.
- Read as written
- A run stops at §9.5 Jobs and Host Operations to Enqueue Jobs, the job loop's check of a Job's abrupt completion (§9.5), when called from §27.5.2.1 NewPromiseReactionJob.
- Default
- The literal text.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum PromiseJobAbruptCompletion=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
The program tests/run/promise_job_abrupt.js, run as ecma-run tests/run/promise_job_abrupt.js with the option of each row:
The literal text (the default)
--erratum PromiseJobAbruptCompletion=literal | stop: erratum PromiseJobAbruptCompletion sec-jobs -: stops at §9.5 Jobs and Host Operations to Enqueue Jobs, the job loop's check of a Job's completion (the step this erratum names) |
|---|
The proposed reading
--erratum PromiseJobAbruptCompletion=proposed | normal: [object #N] |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the proposed reading Open in the debugger: The literal text
Source
// expect: stop: erratum PromiseJobAbruptCompletion sec-jobs -
// NewPromiseReactionJob 1.i returns `? Call(promiseCapability.[[Resolve]], …)`;
// with a species constructor whose resolve throws, the Job returns a throw
// completion, which §9.5 says a Job must not. No test262 test makes a
// reaction Job's resolving function throw; the default reading is the text
// as written (Erratum PromiseJobAbruptCompletion), so the run
// stops. (Engine hosts differ: node goes on silently; the SpiderMonkey shell
// and Bun, with JavaScriptCore, report the throw and go on.)
function Bad(executor) {
executor(function () { throw new Error("boom"); }, function () {});
}
Bad[Symbol.species] = Bad;
var p = Promise.resolve(1);
p.constructor = Bad;
p.then(function (v) { print("handler " + v); return v; });
Promise.resolve(3).then(function () { print("a later Job"); });
default: literalswitched: spec
Write-up 14. Function.prototype.toString has no conforming result for some [[InitialName]] values
§20.2.3.5 Function.prototype.toString, step 3If func is a built-in function object, return an implementation-defined String source code representation of func. The representation must have the syntax of a NativeFunction. Additionally, if func has an [[InitialName]] internal slot and func.[[InitialName]] is a String, the portion of the returned String that would be matched by NativeFunctionAccessor? PropertyName must be func.[[InitialName]].
- The proposed reading
- If func is a built-in function object, return NativeFunctionSource(func).
The overlay's note
The proposed text: "If func is a built-in function object, return an implementation-defined String source code representation of func. The representation must have the syntax of a NativeFunction. Additionally, if func has an [[InitialName]] internal slot, func.[[InitialName]] is a String, and func.[[InitialName]] is matched by NativeFunctionAccessor? PropertyName, the portion of the returned String that would be matched by NativeFunctionAccessor? PropertyName must be func.[[InitialName]]." Both requirements are NativeFunctionSource's law.
- Read as written
- The text never stops a run.
- Default
- The literal text.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum NativeFunctionInitialName=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
No program on this site shows this erratum.
default: literalswitched: spec
Write-up 15. A second Link of a Synthetic Module Record resets its exports, observably with JSON modules
§16.2.1.8.4.4 Link, step 1Let realm be module.[[Realm]].
- The proposed reading
- If module.[[Environment]] is not empty, return unused.
- Let realm be module.[[Realm]].
- Read as written
- The text never stops a run.
- Default
- The literal text.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum SyntheticModuleLinkResets=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
The program tests/run/module_json_relink.js, run as ecma-run --module --module-dir tests/run/modules tests/run/module_json_relink.js with the option of each row:
The literal text (the default)
--erratum SyntheticModuleLinkResets=literal | normal: undefinedmain sees 1probe sees undefinedafter other: 1
|
|---|
The proposed reading
--erratum SyntheticModuleLinkResets=proposed | normal: undefinedmain sees 1probe sees 1after other: 1
|
|---|
Source
// module: yes
// args: --module-dir tests/run/modules
// expect: normal: undefined
// print: main sees 1
// print: probe sees undefined
// print: after other: 1
// Link of a Synthetic Module Record (§16.2.1.8.4.4) runs for every importer
// that is linked (InnerModuleLinking 1.a) and gives the module a new
// environment whose bindings are undefined until it is evaluated again. The
// second importer (modules/relink_other.mjs) imports modules/relink_probe.mjs
// before the JSON module, so the probe runs between the second Link and the
// second evaluation and reads undefined through this module's import. Kept
// literal (Erratum SyntheticModuleLinkResets, docs/spec-issues/15): no
// test262 test evaluates a module in between. Engines print 1.
import j from "./relink.json" with { type: "json" };
export function readJ() { return j; }
print("main sees " + j.a);
import("./relink_other.mjs").then(function () { print("after other: " + j.a); },
function (e) { print("rejected " + e); });
default: proposedswitched: spec
Write-up 20. new Function("o", "return o.#f"): no check of private names in dynamic functions
§20.2.1.1.1 CreateDynamicFunction, step 25If expr is a List of errors, throw a SyntaxError exception.
- The test262 reading
- If expr is a List of errors, throw a SyntaxError exception.
- If AllPrivateIdentifiersValid of body with argument « » is false, throw a SyntaxError exception.
- The proposed reading
- If expr is a List of errors, throw a SyntaxError exception.
- If AllPrivateIdentifiersValid of body with argument « » is false, throw a SyntaxError exception.
- If AllPrivateIdentifiersValid of params with argument « » is false, throw a SyntaxError exception.
- Default
- The proposed reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum CreateDynamicFunctionPrivateIdentifiers=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/dynamic_function_private_identifiers.js, run as ecma-run tests/run/dynamic_function_private_identifiers.js with the option of each row:
The proposed reading (the default)
--erratum CreateDynamicFunctionPrivateIdentifiers=proposed | normal: undefinedbody: SyntaxErrorparams: SyntaxErrorgenerator body: SyntaxError
|
|---|
The test262 reading
--erratum CreateDynamicFunctionPrivateIdentifiers=test262 | normal: undefinedbody: SyntaxErrorparams: no errorgenerator body: SyntaxError
|
|---|
The literal text
--erratum CreateDynamicFunctionPrivateIdentifiers=literal | normal: undefinedbody: no errorparams: no errorgenerator body: no error
|
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the test262 reading Open in the debugger: The specification, with the literal text Open in the debugger: The literal text
Source
// expect: normal: undefined
// print: body: SyntaxError
// print: params: SyntaxError
// print: generator body: SyntaxError
// CreateDynamicFunction steps 18-29: no goal it parses with applies
// AllPrivateIdentifiersValid (Erratum CreateDynamicFunctionPrivateIdentifiers).
// The default reading, the proposed one, adds after step 25
// "If AllPrivateIdentifiersValid of _body_ with argument « » is false, throw a
// SyntaxError exception" and the same of _params_ (spec/formal/readings.emu):
// engines parse the parameters and the body as one source text and throw for
// both. The test262 reading checks the body only, which is all test262's
// built-ins/Function/private-identifiers-not-empty.js asserts
// (dynamic_function_private_identifiers_test262.js); the literal text checks
// neither (dynamic_function_private_identifiers_literal.js).
try { new Function("o", "return o.#f"); print("body: no error"); }
catch (e) { print("body: " + e.constructor.name); }
try { new Function("a = {}.#g", ""); print("params: no error"); }
catch (e) { print("params: " + e.constructor.name); }
var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
try { GeneratorFunction("o", "yield o.#h"); print("generator body: no error"); }
catch (e) { print("generator body: " + e.constructor.name); }
default: test262switched: spec
Write-up 24. CompileToCharSet asks UnicodeMatchPropertyValue for a General_Category value before testing that it is one
§22.2.2.9 Runtime Semantics: CompileToCharSet, step 2If UnicodeMatchPropertyValue(General_Category, s) is a Unicode property value or property value alias for the General_Category (gc) property listed in PropertyValueAliases.txt, then
- The test262 and proposed readings
- If s is a Unicode property value or property value alias for the General_Category (gc) property listed in
PropertyValueAliases.txt, then- Let v be UnicodeMatchPropertyValue(StringToCodePoints("General_Category"), s).
- Return the CharSet containing all Unicode code points whose character database definition includes the property “General_Category” with value v.
- Read as written
- A run stops at §22.2.2.9.8 UnicodeMatchPropertyValue, step 2, when called from §22.2.2.9 Runtime Semantics: CompileToCharSet.
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum LonePropertyGeneralCategoryAssert=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/errata_lone_property_gc_assert_literal.js, run as ecma-run tests/run/errata_lone_property_gc_assert_literal.js with the option of each row:
The test262 reading (the default)
--erratum LonePropertyGeneralCategoryAssert=test262 | normal: true |
|---|
The literal text
--erratum LonePropertyGeneralCategoryAssert=literal | stop: erratum LonePropertyGeneralCategoryAssert sec-runtime-semantics-unicodematchpropertyvalue-p-v#0 2: stops at §22.2.2.9.8 UnicodeMatchPropertyValue, step 2 (the step this erratum names) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// expect: stop: erratum LonePropertyGeneralCategoryAssert sec-runtime-semantics-unicodematchpropertyvalue-p-v#0 2
// args: --erratum LonePropertyGeneralCategoryAssert=literal
// CompileToCharSet's lone \p{X} (Erratum LonePropertyGeneralCategoryAssert): the
// literal reading passes the String "General_Category" to UnicodeMatchPropertyValue
// and asks it for a binary property's name, and the run stops as the erratum.
/\p{ASCII}/u.test("a");
default: test262switched: spec
Write-up 43. AllocateSharedArrayBuffer stores a growable buffer's length with SetValueInBuffer on a Shared Data Block
§25.2.2.1 AllocateSharedArrayBuffer, step 9.cPerform SetValueInBuffer(byteLengthBlock, 0, biguint64, ℤ(byteLength), true, seq-cst).
- The test262 and proposed readings
- Let agentRecord be the Agent Record of the surrounding agent.
- Let rawBytes be NumericToRawBytes(biguint64, ℤ(byteLength), agentRecord.[[LittleEndian]]).
- Let execution be agentRecord.[[CandidateExecution]].
- Let eventsRecord be the Agent Events Record of execution.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier().
- Append WriteSharedMemory { [[Order]]: seq-cst, [[NoTear]]: true, [[Block]]: byteLengthBlock, [[ByteIndex]]: 0, [[ElementSize]]: 8, [[Payload]]: rawBytes } to eventsRecord.[[EventList]].
The overlay's note
SetValueInBuffer takes an ArrayBuffer or SharedArrayBuffer (its step 4 reads [[ArrayBufferData]]); byteLengthBlock is a Shared Data Block, which ArrayBufferByteLength and SharedArrayBuffer.prototype.grow read with GetRawBytesFromSharedBlock. The reading writes it as SetValueInBuffer's shared branch would (IsNoTearConfiguration(biguint64, seq-cst) is true). test262 constructs growable SharedArrayBuffers (built-ins/SharedArrayBuffer/prototype/grow).
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum AllocateSharedArrayBufferByteLengthStore=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/errata_allocate_sab_byte_length.js, run as ecma-run tests/run/errata_allocate_sab_byte_length.js with the option of each row:
The test262 reading (the default)
--erratum AllocateSharedArrayBufferByteLengthStore=test262 | normal: 2 |
|---|
The literal text
--erratum AllocateSharedArrayBufferByteLengthStore=literal | stop: sortError sec-setvalueinbuffer#0 4: stops at §25.1.3.18 SetValueInBuffer, step 4 (a value of the wrong sort reaches the step) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// expect: normal: 2
// A growable SharedArrayBuffer (Erratum AllocateSharedArrayBufferByteLengthStore): the
// test262 reading stores the byte length in its Shared Data Block, which grow reads.
var b = new SharedArrayBuffer(1, { maxByteLength: 4 });
b.grow(2);
b.byteLength;
default: test262switched: spec
Write-up 35. Contains never finds an AwaitExpression: async function f(x = await 1) {} has no early error
§8.5.1 Static Semantics: Contains, step 1.aIf child is an instance of symbol, return true.
- The test262 and proposed readings
- If child is an instance of symbol, return true.
- If symbol is AwaitExpression and this Parse Node is an instance of the production
UnaryExpression : CoverAwaitExpressionAndAwaitUsingDeclarationHead, return true.
The overlay's note
An await expression parses as UnaryExpression : CoverAwaitExpressionAndAwaitUsingDeclarationHead, and AwaitExpression is only the cover's refined interpretation, so the default definition never meets an AwaitExpression and every early error rule "X Contains AwaitExpression" holds vacuously. test262 requires them (built-ins/AsyncGeneratorFunction/instance-await-expr-in-param.js, language/expressions/async-generator/early-errors-expression-formals-contains-await-expr.js, language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js). The reading counts the cover of that production, and not the cover of an AwaitUsingDeclaration, as an AwaitExpression. The proposed text is the equivalent Contains row for UnaryExpression : CoverAwaitExpressionAndAwaitUsingDeclarationHead: "1. If symbol is AwaitExpression, return true. 2. Let expr be the AwaitExpression that is covered by CoverAwaitExpressionAndAwaitUsingDeclarationHead. 3. Return expr Contains symbol."
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum ContainsAwaitCover=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/await_in_params_early_errors.js, run as ecma-run tests/run/await_in_params_early_errors.js with the option of each row:
The test262 reading (the default)
--erratum ContainsAwaitCover=test262 | normal: undefinedasync function: SyntaxErrorasync function expression: SyntaxErrorasync generator: SyntaxErrorasync generator expression: SyntaxErrorasync method: SyntaxErrorasync generator method: SyntaxErrorarrow in async body: SyntaxErrorasync arrow in async body: SyntaxErrorAsyncFunction: SyntaxErrorAsyncGeneratorFunction: SyntaxErrorawait in async body: no errorstatic block in async function: no errorvar await in nested function: no errorasync arrow parameters: no errorawait in static block: SyntaxErrorvar await in static block function: no error
|
|---|
The literal text
--erratum ContainsAwaitCover=literal | normal: undefinedasync function: no errorasync function expression: no errorasync generator: no errorasync generator expression: no errorasync method: no errorasync generator method: no errorarrow in async body: no errorasync arrow in async body: no errorAsyncFunction: no errorAsyncGeneratorFunction: no errorawait in async body: no errorstatic block in async function: no errorvar await in nested function: no errorasync arrow parameters: no errorawait in static block: SyntaxErrorvar await in static block function: no error
|
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// expect: normal: undefined
// print: async function: SyntaxError
// print: async function expression: SyntaxError
// print: async generator: SyntaxError
// print: async generator expression: SyntaxError
// print: async method: SyntaxError
// print: async generator method: SyntaxError
// print: arrow in async body: SyntaxError
// print: async arrow in async body: SyntaxError
// print: AsyncFunction: SyntaxError
// print: AsyncGeneratorFunction: SyntaxError
// print: await in async body: no error
// print: static block in async function: no error
// print: var await in nested function: no error
// print: async arrow parameters: no error
// print: await in static block: SyntaxError
// print: var await in static block function: no error
// The early errors "X Contains |AwaitExpression|" (§15.3.1, §15.6.1, §15.8.1,
// §15.9.1): an `await` expression is the cover of UnaryExpression :
// CoverAwaitExpressionAndAwaitUsingDeclarationHead, which Contains counts as an
// AwaitExpression (Erratum ContainsAwaitCover, its test262 reading).
// Contains does not look into nested functions, and a static block's rule is
// on the terminal `await`.
var AsyncFunction = (async function () {}).constructor;
var AsyncGeneratorFunction = (async function* () {}).constructor;
function check(name, run) {
try { run(); print(name + ": no error"); }
catch (e) { print(name + ": " + e.constructor.name); }
}
function script(src) { return function () { (0, eval)(src); }; }
check("async function", script("async function f(x = await 1) {}"));
check("async function expression", script("(async function (x = await 1) {})"));
check("async generator", script("async function* f(x = await 1) {}"));
check("async generator expression", script("(async function* (x = await 1) {})"));
check("async method", script("({ async m(x = await 1) {} })"));
check("async generator method", script("({ async *m(x = await 1) {} })"));
check("arrow in async body", script("async function g() { (x = await 1) => 0; }"));
check("async arrow in async body", script("async function g() { async (x = await 1) => 0; }"));
check("AsyncFunction", function () { AsyncFunction("x = await 1", ""); });
check("AsyncGeneratorFunction", function () { AsyncGeneratorFunction("x = await 1", ""); });
check("await in async body", script("async function h() { await 1; }"));
check("static block in async function", script("(async function () { class C { static { } } })"));
check("var await in nested function", script("async function k(x = function () { var await; }) {}"));
check("async arrow parameters", script("async (x = 1) => await x;"));
check("await in static block", script("class C { static { await 0; } }"));
check("var await in static block function", script("class C { static { (function () { var await; }); } }"));
default: test262switched: spec
Write-up 37. String.prototype.split with an empty separator builds an Array of code units
§22.1.3.23 String.prototype.split, step 10.dLet codeUnits be a List consisting of the sequence of code units that are the elements of head.
- The test262 and proposed readings
- Let codeUnits be a new empty List.
- For each integer i such that 0 ≤ i < outLength, in ascending order, do
- Append the substring of head from i to i + 1 to codeUnits.
The overlay's note
The literal step passes a List of code units to CreateArrayFromList, whose parameter is a List of ECMAScript language values; a code unit is not one. test262 requires the Array's elements to be the Strings of one code unit each (built-ins/String/prototype/split/separator-empty-string-instance-is-string.js), as the method's description says: "any separator coerced to the empty String splits the this value into individual code units".
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum SplitCodeUnitStrings=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/errata_split_code_units.js, run as ecma-run tests/run/errata_split_code_units.js with the option of each row:
The test262 reading (the default)
--erratum SplitCodeUnitStrings=test262 | normal: "string" |
|---|
The literal text
--erratum SplitCodeUnitStrings=literal | stop: sortError sec-typeof-operator-runtime-semantics-evaluation#0 13: stops at §13.5.3.1 Runtime Semantics: Evaluation, step 13 (a value of the wrong sort reaches the step) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// expect: normal: "string"
// String.prototype.split with the empty String as separator (Erratum SplitCodeUnitStrings):
// the test262 reading makes each element a String of one code unit.
typeof "ab".split("")[1];
default: literalswitched: none
Write-up 23. Races: "it is not the case that both" is always true
§29.8 Races, step 1.aIf it is not the case that both eventA happens-before eventB in execution and eventB happens-before eventA in execution, then
The overlay's note
Step 1.a of Races (sec-races) is always true: an execution's happens-before is a strict partial order, so eventA and eventB never both happen-before each other, and any two conflicting events race. The memory model's meaning (Ecma.MemoryModel.Race) reads the literal text. The proposed text of step 1.a: "If neither eventA happens-before eventB in execution nor eventB happens-before eventA in execution, then".
- Read as written
- The text never stops a run.
- Default
- The literal text.
- Switched
- Nowhere. The overlay holds one reading, and no option changes it.
No program on this site shows this erratum.
default: literalswitched: none
Write-up 48. happens-before orders an init write only before events with overlapping ranges, which excludes the equal range of a 1-byte access
§29.6.6 happens-before, the third conditionSharedDataBlockEventSet(execution) contains both eventA and eventB, eventA.[[Order]] is init, and eventA and eventB have overlapping memory ranges.
The overlay's note
The third condition of happens-before orders an init write only before events whose memory ranges are overlapping, and "overlapping" excludes equal ranges, so a 1-byte event at an init event's byte is not ordered after it. The proposed text: "SharedDataBlockEventSet(execution) contains both eventA and eventB, eventA.[[Order]] is init, eventA and eventB are not the same Shared Data Block event, and eventA and eventB do not have disjoint memory ranges."
- Read as written
- The text never stops a run.
- Default
- The literal text.
- Switched
- Nowhere. The overlay holds one reading, and no option changes it.
No program on this site shows this erratum.
default: proposedswitched: none
Write-up 50. reads-bytes-from and coherent reads ask only for a byte index in a memory range, which names no [[Block]]
§29.6.2 reads-bytes-fromEach event writeEvent with index i in writes has readEvent.[[ByteIndex]] + i in its memory range.
The overlay's note
A memory range is a Set of integers, the byte indices from [[ByteIndex]], with no [[Block]] in it, so reads-bytes-from's "has readEvent.[[ByteIndex]] + i in its memory range" and coherent reads' "has byteLocation in its memory range" (step 1.c.ii) admit a write to another Shared Data Block at the same index. The proposed text, which the memory model's meaning (Ecma.MemoryModel.Rbf.Valid, CoherentReads) reads: "Each event writeEvent with index i in writes has readEvent.[[Block]] as its [[Block]] and readEvent.[[ByteIndex]] + i in its memory range", and in step 1.c.ii "a WriteSharedMemory or ReadModifyWriteSharedMemory event value whose [[Block]] is readEvent.[[Block]] and that has byteLocation in its memory range".
- Default
- The proposed reading.
- Switched
- Nowhere. The overlay holds one reading, and no option changes it.
No program on this site shows this erratum.
default: test262switched: spec
Write-up 33. CreateIntrinsics passes async in prefix's position: every built-in gets a Boolean prefix
§9.3.2 CreateIntrinsics, step 2Set fields of realmRecord.[[Intrinsics]] with the values listed in a table of §6.1.7.4. The field names are the names listed in the “Intrinsic Name” column of the table. The value of each field is a new object value fully and recursively populated with property values as defined by the specification of each object in clauses §19 through §28. All object property values are newly created object values. All values that are built-in function objects are created by performing CreateBuiltinFunction(steps, length, name, slots, realmRecord, proto, async) where steps is the definition of that function provided by this specification, name is the initial value of the function's "name" property, length is the initial value of the function's "length" property, slots is a list of the names, if any, of the function's specified internal slots, proto is the specified value of the function's [[Prototype]] internal slot, and async is true if the function is described as “async” and false otherwise. The creation of the intrinsics and their properties must be ordered to avoid any dependencies upon objects that have not yet been created.
- The test262 and proposed readings
- Let entries be IntrinsicObjects().
- Let objects be a new empty List.
- For each Record entry of entries, do
- If entry.[[Prototype]] is null, let proto be null; else let proto be objects[entry.[[Prototype]]].
- If entry.[[Behaviour]] is not empty, then
- If entry.[[Prefix]] is empty, let obj be CreateBuiltinFunction(entry.[[Behaviour]], entry.[[Length]], entry.[[Name]], entry.[[Slots]], realmRecord, proto); else let obj be CreateBuiltinFunction(entry.[[Behaviour]], entry.[[Length]], entry.[[Name]], entry.[[Slots]], realmRecord, proto, entry.[[Prefix]]).
- Set obj.[[Async]] to entry.[[Async]].
- If entry.[[Constructor]] is true, set obj.[[Construct]] to the definition specified in §10.3.2.
- Else,
- Let obj be OrdinaryObjectCreate(proto, entry.[[Slots]]).
- If entry.[[Exotic]] is §10.4.2, then
- Set obj.[[DefineOwnProperty]] as specified in §10.4.2.1.
- Else if entry.[[Exotic]] is §10.4.3, then
- Set obj.[[GetOwnProperty]] as specified in §10.4.3.1.
- Set obj.[[DefineOwnProperty]] as specified in §10.4.3.2.
- Set obj.[[OwnPropertyKeys]] as specified in §10.4.3.3.
- Else if entry.[[Exotic]] is §10.4.7, then
- Set obj.[[SetPrototypeOf]] to the definition specified in §10.4.7.1.
- For each Record slot of entry.[[SlotValues]], do
- Perform SetFieldNamed(obj, slot.[[Name]], slot.[[Value]]).
- For each element name of entry.[[Names]], do
- Perform SetFieldNamed(realmRecord.[[Intrinsics]], name, obj).
- Append obj to objects.
- For each Record entry of entries, do
- Let obj be objects[entry.[[Index]]].
- If entry.[[Behaviour]] is not empty, then
- Let la be entry.[[LengthAttributes]].
- Perform ! DefinePropertyOrThrow(obj, "length", PropertyDescriptor { [[Writable]]: la.[[Writable]], [[Enumerable]]: la.[[Enumerable]], [[Configurable]]: la.[[Configurable]] }).
- Let na be entry.[[NameAttributes]].
- Perform ! DefinePropertyOrThrow(obj, "name", PropertyDescriptor { [[Writable]]: na.[[Writable]], [[Enumerable]]: na.[[Enumerable]], [[Configurable]]: na.[[Configurable]] }).
- For each Record p of PropertyOrder(obj, entry.[[Properties]]), do
- If PropertyProvided(p) is true, perform OwnPropertyCreate(obj, p.[[Key]], IntrinsicPropertyDescriptor(p, objects), p.[[Kind]]).
- Set obj.[[Extensible]] to entry.[[Extensible]].
The overlay's note
Step 2 creates each built-in function by "CreateBuiltinFunction(steps, length, name, slots, realmRecord, proto, async)", which passes async as CreateBuiltinFunction's prefix and gives no accessor its prefix; read literally (realm.emu), SetFunctionName concatenates a Boolean and realm creation stops. test262 requires both: built-ins/Array/fromAsync/ (an async function) and built-ins/Map/prototype/size/name.js ("get size"). The proposed text: "CreateBuiltinFunction(steps, length, name, slots, realmRecord, proto, prefix, async), where prefix is "get" or "set" for a get or set accessor function of a built-in property and empty otherwise", with an empty prefix read as not present.
- Read as written
- A run stops at §10.2.9 SetFunctionName, step 5.a, when called from §10.3.4 CreateBuiltinFunction.
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum CreateIntrinsicsAsyncArgument=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/errata_createintrinsics_async_argument.js, run as ecma-run tests/run/errata_createintrinsics_async_argument.js with the option of each row:
The test262 reading (the default)
--erratum CreateIntrinsicsAsyncArgument=test262 | normal: "get size|true" |
|---|
The literal text
--erratum CreateIntrinsicsAsyncArgument=literal | stop: erratum CreateIntrinsicsAsyncArgument sec-setfunctionname#0 5.a: stops at §10.2.9 SetFunctionName, step 5.a (the step this erratum names) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// expect: normal: "get size|true"
// CreateIntrinsics step 2 (Erratum CreateIntrinsicsAsyncArgument): the
// test262 reading passes a getter its prefix and Array.fromAsync its [[Async]].
var r = [];
r.push(Object.getOwnPropertyDescriptor(Map.prototype, "size").get.name);
r.push(Array.fromAsync([1]) instanceof Promise);
r.join("|");
default: test262switched: spec
Write-up 31. Sort: a comparator that returns ±∞ is neither consistent nor inconsistent
§23.1.3.30.1 SortIndexedProperties, step 4Sort items using an implementation-defined sequence of calls to sortCompare. If any such call returns an abrupt completion, stop before performing any further calls to sortCompare and return that Completion Record.
- The test262 and proposed readings
- Let next be SortStep(the number of elements in items, empty, empty).
- Repeat, while next is a List,
- Let result be sortCompare(items[next[0]], items[next[1]]).
- If result is an abrupt completion, return result.
- Set next to SortStep(the number of elements in items, next[2], result).
- Let sorted be a new empty List.
- For each element i of next.[[Value]], do
- Append items[i] to sorted.
- Set items to sorted.
The overlay's note
The definition of a consistent comparator reads each result as ℝ(comparator(a, b)), which has no value for ±∞; the literal reading (sort.emu) stops there. No test262 test has a comparator return ±∞. The test262 reading has no ℝ step: by SortStep's law (sort.emu) no consistent comparator gives a ±∞ result, so the order is the host's, and both test hosts order by the result's sign. The proposed text compares the Number itself with +0𝔽 where the text takes ℝ of it, in the sort order's two conditions ("if sortCompare(old[j], old[k]) < +0𝔽", "… = +0𝔽") and in the definition of a consistent comparator ("a <C b means comparator(a, b) < +0𝔽", likewise for =C and >C).
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum SortInfiniteComparator=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/errata_sort_infinite_comparator.js, run as ecma-run tests/run/errata_sort_infinite_comparator.js with the option of each row:
The test262 reading (the default)
--erratum SortInfiniteComparator=test262 | normal: "1,2,3|3,2,1" |
|---|
The literal text
--erratum SortInfiniteComparator=literal | stop: sortError sec-sortindexedproperties#0 4..ccxlii.2.c: stops at §23.1.3.30.1 SortIndexedProperties, step 4 (inside the reading of that step) (a value of the wrong sort reaches the step) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text Open in the debugger: The literal text
Source
// expect: normal: "1,2,3|3,2,1"
// A comparator that returns ±Infinity (Erratum SortInfiniteComparator): under
// the test262 reading the order is the host's, and the test host's goes by the
// result's sign.
var r = [];
r.push([3, 1, 2].sort(function (a, b) { return a < b ? -Infinity : a > b ? Infinity : 0; }).join());
r.push([1, 3, 2].sort(function (a, b) { return a < b ? Infinity : a > b ? -Infinity : 0; }).join());
r.join("|");
default: test262switched: spec
Write-up 45. FinalizationRegistry.prototype.unregister removes cells from the List it iterates
§26.2.3.3 FinalizationRegistry.prototype.unregister, step 5For each Record { [[WeakRefTarget]], [[HeldValue]], [[UnregisterToken]] } cell of finalizationRegistry.[[Cells]], do
- The test262 and proposed readings
- Let cells be a copy of finalizationRegistry.[[Cells]].
- For each Record { [[WeakRefTarget]], [[HeldValue]], [[UnregisterToken]] } cell of cells, do
- If cell.[[UnregisterToken]] is not empty and SameValue(cell.[[UnregisterToken]], unregisterToken) is true, then
- Remove cell from finalizationRegistry.[[Cells]].
- Set removed to true.
The overlay's note
The literal step removes from the List it iterates, and the For each convention does not say which element comes next; read literally, the cell after a removed one is skipped. test262 requires every cell with the token to go (built-ins/FinalizationRegistry/prototype/unregister/unregister-object-token.js and unregister-symbol-token.js register two cells with one token in a row). The proposed text iterates a copy, as above.
- Read as written
- The text never stops a run.
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum UnregisterIteratesCopy=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/errata_unregister_two_cells.js, run as ecma-run tests/run/errata_unregister_two_cells.js with the option of each row:
The test262 reading (the default)
--erratum UnregisterIteratesCopy=test262 | normal: "true|false" |
|---|
The literal text
--erratum UnregisterIteratesCopy=literal | normal: "true|true" |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text Open in the debugger: The literal text
Source
// expect: normal: "true|false"
// Two cells with one unregister token, in a row (Erratum
// UnregisterIteratesCopy): the test262 reading removes both.
var fr = new FinalizationRegistry(function () {});
var token = {};
fr.register({}, 1, token);
fr.register({}, 2, token);
[fr.unregister(token), fr.unregister(token)].join("|");
default: test262switched: spec
Write-up 49. Annex B: /[\c1-\c5]/ asks for the IsCharacterClass of ClassEscape :: c ClassControlLetter, which has none
§B.1.2.3 Static Semantics: IsCharacterClass has no row for ClassEscape :: `c` ClassControlLetter.
- The test262 and proposed readings
- Return false.
The overlay's note
IsCharacterClass has no definition for this production of §B.1.2, whose CharacterValue §B.1.2.4 gives, and §B.1.2.1's range rules ask for it of every ClassAtom of a range: /[\c1-\c5]/. The literal text stops there (it asks IsCharacterClass of ClassControlLetter, which has no definition either). The row is the twin of ClassEscape :: CharacterEscape's: the escape is one character. No test262 test has \c and a digit or _ at a range's end; annexB/language/literals/regexp/class-escape.js reads [\c1] as U+0011.
- Default
- The test262 reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum IsCharacterClassControlLetter=READING runs a program under one of them (literal, test262, proposed), and the engine's theorem holds under every choice.
The program tests/run/errata_ischaracterclass_control_letter.js, run as ecma-run --annex-b sec-regular-expressions-patterns tests/run/errata_ischaracterclass_control_letter.js with the option of each row:
The test262 reading (the default)
--erratum IsCharacterClassControlLetter=test262 | normal: true |
|---|
The literal text
--erratum IsCharacterClassControlLetter=literal | stop: sortError row-ischaracterclass-classcontrolletter#0 1: stops at row-ischaracterclass-classcontrolletter (a reading of the overlay), step 1 (a value of the wrong sort reaches the step) |
|---|
Open in the debugger: The specification Open in the debugger: The specification, with the literal text
Source
// expect: normal: true
// args: --annex-b sec-regular-expressions-patterns
// A class range between two \c escapes of B.1.2 (Erratum IsCharacterClassControlLetter):
// the test262 reading gives IsCharacterClass a row for ClassEscape :: `c` ClassControlLetter.
/[\c1-\c5]/.test("\x11");
default: proposedswitched: spec
Write-up 53. Maximum String length is unspecified and leaves "a".repeat(2 ** 30) exact up to 2^53 - 1
§22.1.3.18 String.prototype.repeat, step 7Return the String value that is made from n copies of string appended together.
- The proposed reading
- If StringTooLarge(n × the length of string) is true, throw a RangeError exception.
- Return the String value that is made from n copies of string appended together.
§22.1.3.17.1 StringPaddingBuiltinsImpl, step 7Return StringPad(string, intMaxLength, fillString, placement).
- The proposed reading
- If fillString is not the empty String and StringTooLarge(intMaxLength) is true, throw a RangeError exception.
- Return StringPad(string, intMaxLength, fillString, placement).
§22.1.3.5 String.prototype.concat, step 5.bSet result to the string-concatenation of result and nextString.
- The proposed reading
- If StringTooLarge(the length of result + the length of nextString) is true, throw a RangeError exception.
- Set result to the string-concatenation of result and nextString.
§13.15.3 ApplyStringOrNumericBinaryOperator, step 1.c.iiiReturn the string-concatenation of leftString and rightString.
- The proposed reading
- If StringTooLarge(the length of leftString + the length of rightString) is true, throw a RangeError exception.
- Return the string-concatenation of leftString and rightString.
§23.1.3.18.1 JoinIndexedProperties, step 4.aIf k > 0, set result to the string-concatenation of result and separator.
- The proposed reading
- If k > 0, then
- If StringTooLarge(the length of result + the length of separator) is true, throw a RangeError exception.
- Set result to the string-concatenation of result and separator.
§23.1.3.18.1 JoinIndexedProperties, step 4.d.iiiSet result to the string-concatenation of result and elementString.
- The proposed reading
- If StringTooLarge(the length of result + the length of elementString) is true, throw a RangeError exception.
- Set result to the string-concatenation of result and elementString.
The overlay's note
§6.1.4 defines the String type as sequences of up to 253 - 1 16-bit code units and leaves the operations' behaviour unspecified when a result would exceed an implementation's smaller maximum String length; every engine throws a RangeError past its limit (V8 228 on 32-bit targets and 229 - 24 on 64-bit, SpiderMonkey 230 - 2, JavaScriptCore 231 - 1). The proposed text checks StringTooLarge before constructing the String and throws a RangeError exception when true (write-up 53).
- Default
- The proposed reading.
- Switched
- In the specification, at run time. Its readings are a parameter of the specification's machine:
ecma-run --erratum StringMaximumLength=READING runs a program under one of them (literal, proposed), and the engine's theorem holds under every choice.
No program on this site shows this erratum.
default: literalswitched: none
Write-up 52. Static Semantics: MV has a row for ` DecimalIntegerLiteral :: 0 `, a production the grammar does not have
§12.9.3.2 Static Semantics: MV, an equation rowThe MV of DecimalIntegerLiteral :: `0` is 0.
The overlay's note
§12.9.3 defines DecimalIntegerLiteral as "DecimalDigit", "NonZeroDigit NumericLiteralSeparator? DecimalDigits[+Sep]" and "NonOctalDecimalIntegerLiteral", and has no production DecimalIntegerLiteral :: `0`; §12.9.3.2 MV still has the row "The MV of DecimalIntegerLiteral :: `0` is 0." The row names no production of the grammar, so it is never applied: the MV of the literal 0 is that of DecimalIntegerLiteral :: DecimalDigit, the MV of its DecimalDigit, which is 0. Both readings agree. The proposed text: delete the row (write-up 52).
- Read as written
- The text never stops a run.
- Default
- The literal text.
- Switched
- Nowhere. The overlay holds one reading, and no option changes it.
No program on this site shows this erratum.