Recognize additional JavaScript early errors in Test262 runner

This commit is contained in:
Chris Tate
2026-09-27 13:36:18 -05:00
parent ffe5e27563
commit bc70f2e16f
6 changed files with 111 additions and 2 deletions
+7 -2
View File
@@ -167,8 +167,13 @@ function parseDiagnostics(source, variant) {
// pass. Matching the compiler's diagnostic at the original source location
// keeps type-checking errors and the harness's $DONOTEVALUATE error out.
const earlyErrorCodes = new Set([
1005, 1013, 1048, 1091, 1136, 1156, 1186, 1214, 1215, 1346, 1347, 1359,
1500, 1508, 1522, 1524, 2300, 2364, 2451, 2462, 2491, 2779, 17012, 18061,
1005, 1013, 1048, 1091, 1107, 1108, 1115, 1116, 1136, 1155, 1156, 1186,
1190, 1213, 1214, 1215, 1325, 1346, 1347, 1358, 1359,
1499, 1500, 1502, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512,
1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524,
1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535,
18006, 18011, 18012, 18016, 2300, 2337, 2364, 2451, 2462, 2491, 2523,
2779, 2804, 17012, 18061,
]);
function earlyErrorDiagnostics(source, variant) {
+8
View File
@@ -89,6 +89,7 @@
"test/built-ins/Object/prototype/toString/Object.prototype.toString.call-regexp.js",
"test/built-ins/Object/prototype/toString/Object.prototype.toString.call-string.js",
"test/built-ins/Object/prototype/toString/Object.prototype.toString.call-undefined.js",
"test/built-ins/RegExp/property-escapes/character-class-range-start.js",
"test/built-ins/RegExp/prototype/test/S15.10.6.3_A1_T16.js",
"test/built-ins/String/prototype/at/index-argument-tointeger.js",
"test/built-ins/String/prototype/at/index-non-numeric-argument-tointeger.js",
@@ -172,7 +173,9 @@
"test/language/expressions/addition/S11.6.1_A4_T3.js",
"test/language/expressions/addition/S11.6.1_A4_T4.js",
"test/language/expressions/assignmenttargettype/direct-arrowfunction-2.js",
"test/language/expressions/class/elements/fields-string-name-propname-constructor.js",
"test/language/expressions/function/dflt-params-duplicates.js",
"test/language/statements/class/class-name-ident-static.js",
"test/language/statements/const/dstr/ary-ptrn-elem-ary-elem-init.js",
"test/language/statements/const/dstr/ary-ptrn-elem-id-init-exhausted.js",
"test/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js",
@@ -186,6 +189,7 @@
"test/language/statements/let/dstr/ary-ptrn-elem-id-init-exhausted.js",
"test/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js",
"test/language/statements/let/dstr/ary-ptrn-elem-obj-id-init.js",
"test/language/statements/return/S12.9_A1_T1.js",
"test/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-init.js",
"test/language/statements/variable/dstr/ary-ptrn-elem-id-init-exhausted.js",
"test/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js",
@@ -279,6 +283,7 @@
"test/built-ins/Object/prototype/toString/Object.prototype.toString.call-regexp.js": "bf86ec4cf260104df8f24b6a6a182baf086d6751940f0fe98288273d8382792c",
"test/built-ins/Object/prototype/toString/Object.prototype.toString.call-string.js": "11394822ae328273cf08b860121d140ca9541b112540941da15c74996d50817a",
"test/built-ins/Object/prototype/toString/Object.prototype.toString.call-undefined.js": "dd0ec3d0eeea7252f01fcf76abfdc8899f52d64b472fbe6f55cbdaf85766623d",
"test/built-ins/RegExp/property-escapes/character-class-range-start.js": "1dd2fce44d8208288aaba6a7edbc03d08aeb3c796258a3c01b34e1113ee75dc8",
"test/built-ins/RegExp/prototype/test/S15.10.6.3_A1_T16.js": "c96f0402289d55e41a2e0ef322060c5a143b599f456b94dc5ebe0493bc689f42",
"test/built-ins/String/prototype/at/index-argument-tointeger.js": "563b86b614bb22f0bdc35ab51d67bf1ea68395e71bb22699f92ab48eed02337f",
"test/built-ins/String/prototype/at/index-non-numeric-argument-tointeger.js": "37a09110b92218ff022e8e84abee3259c6083d880f193fc679f1bbfb803de03e",
@@ -362,7 +367,9 @@
"test/language/expressions/addition/S11.6.1_A4_T3.js": "987b1c3cf66b6bbb2f6d8aaf6d1435cb1238b19132fa861a91aa2c35085d229d",
"test/language/expressions/addition/S11.6.1_A4_T4.js": "88afbecfcbb69c52a7ecc79c4b2dda351fffc5b75453b5b787a7f97afe8f4229",
"test/language/expressions/assignmenttargettype/direct-arrowfunction-2.js": "66ecd486e3cdb383ac6cdd655b70fc495b61bff90e6a125e491d9f1ed183c9f3",
"test/language/expressions/class/elements/fields-string-name-propname-constructor.js": "70bce532b9f18d8795e9ea5d640bdd063004ce873d614cca05d8071aa615a605",
"test/language/expressions/function/dflt-params-duplicates.js": "243c05deb19b7d54a13d4f69059a8fb8d55911f066b5cc0ae14cfc41503c28ae",
"test/language/statements/class/class-name-ident-static.js": "04d24cb0b646cf244fdde005cf3c6ecf6ae82897265ab3e1fe5cab7a4d6f6a64",
"test/language/statements/const/dstr/ary-ptrn-elem-ary-elem-init.js": "00f23ce81293acc6bd718a5a0de431928ed18db45c7ce849a0f76c365bc1ec9a",
"test/language/statements/const/dstr/ary-ptrn-elem-id-init-exhausted.js": "73e765928b855ea0f89bd159a317ec212179260523d444e38b3518c8ac6c1681",
"test/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js": "086210fc19498dad9b760b90398a3b46b366f3c4d4ee184200136641752ba832",
@@ -376,6 +383,7 @@
"test/language/statements/let/dstr/ary-ptrn-elem-id-init-exhausted.js": "23fcda62dd2929425d0b5a07550a324500ba9e4bf2f077b976afcc2720f77c47",
"test/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js": "29f0cda5bb499b41f6ceba77cb98063bea79415d006ee01e6bd9e5e975303103",
"test/language/statements/let/dstr/ary-ptrn-elem-obj-id-init.js": "eaa8c6110ee9844b664de6c6843fab0b4b1e677d8825e76dc516a5e685ef07ec",
"test/language/statements/return/S12.9_A1_T1.js": "bc84790726a54897193596753ab94a938d2ce31689bdc04e3e976a40eb0203a5",
"test/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-init.js": "f87720eef9f3697de48d6a7feaf5dcd872dfa907e6a41b610f02ee95775ad257",
"test/language/statements/variable/dstr/ary-ptrn-elem-id-init-exhausted.js": "9b93cfddea8593d0b9130d96c7ee7d89f5efc1b3831d7d7aadc0fc503c4fd94c",
"test/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js": "f5f4a7260fd8768d5d5d28934ba866ae2854b36570c4b71c8e9a25fb6a077a63",
@@ -0,0 +1,20 @@
// Copyright 2018 Mathias Bynens. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Mathias Bynens
description: >
NonemptyClassRanges :: ClassAtom - ClassAtom ClassRanges
It is a Syntax Error if IsCharacterClass of the first ClassAtom is
true or IsCharacterClass of the second ClassAtom is true.
esid: sec-patterns-static-semantics-early-errors
negative:
phase: parse
type: SyntaxError
features: [regexp-unicode-property-escapes]
---*/
$DONOTEVALUATE();
/[\p{Hex}--]/u;
@@ -0,0 +1,30 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: class fields forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden)
esid: sec-class-definitions-static-semantics-early-errors
features: [class, class-fields-public]
negative:
phase: parse
type: SyntaxError
info: |
Static Semantics: PropName
...
LiteralPropertyName : StringLiteral
Return the String value whose code units are the SV of the StringLiteral.
// This test file tests the following early error:
Static Semantics: Early Errors
ClassElement : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
$DONOTEVALUATE();
var C = class {
'constructor';
};
@@ -0,0 +1,27 @@
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-class-definitions
description: >
`static` is not a valid class-name identifier.
info: |
12.1.1 Static Semantics: Early Errors
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements", "interface", "let", "package",
"private", "protected", "public", "static", or "yield".
10.2.1 Strict Mode Code
All parts of a ClassDeclaration or a ClassExpression are strict mode code.
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
class static {}
@@ -0,0 +1,19 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Appearing of "return" without a function body leads to syntax error
es5id: 12.9_A1_T1
description: Checking if execution of "return" with no function fails
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
var x=1;
return;
var y=2;