Commit Graph
38 Commits
Author SHA1 Message Date
Chris Tate 352842f020 Scope early errors to function bodies and class strictness, and match the upstream compareArray reads
- A function body or class static block treats its top-level function
  declarations as var-scoped: duplicates are legal in strict code, and a
  let/const/class of the same name is SC0006.
- Strictness is the code around a node: a function declaration's own
  "use strict" no longer makes its declaring context strict.
- Every part of a class is strict; object literal methods and accessors
  are strict only by their own prologue or their surroundings, and an
  arrow function's block body can carry "use strict".
- The bare compareArray reads b.length, then a.length, and a.length again
  before every element pair, converting it as the upstream `i < a.length`
  does, so a string length compares its elements.
- Tests that relied on the old handling of undeclared names now use
  constructs that are still refused or still compile: the installed-entry
  diagnostics fixture reports a syntax error (a read of an undeclared name
  is now Node's run-time ReferenceError), and static-objects-order's
  loops.js stores from its for-in head into `undefined` instead of an
  undeclared name (a store into an undeclared name refuses its package with
  SC1091).
2026-10-29 08:37:25 -05:00
Malte UblandClaude Opus 5.5 b234e06f20 Enforce the ECMAScript early errors the checker does not model
Static semantics reject a program before it runs. Until now the compiler
borrowed that rejection from whatever tsc happened to report, and Test262's
negative-parse suites show where the borrowing stops: programs the spec
makes SyntaxErrors compile and run. This adds the two largest families the
grab-bag misses (plan §7.7 D-4, option c), each under its own preflight
code, so a checker relaxation can never remove the only rejection a
parse-negative program had:

  SC0005  a statement list declares one lexical name twice
          (`{ class f {} async function f() {} }`)
  SC0006  a lexical name is `var`-declared in the same statement list
          (`switch (1) { case 1: let x; case 2: var x; }`)
  SC0007  a declaration where the grammar admits only a Statement
          (`while (false) function f() {}`, `l: class c {}`,
          `if (x) async function f() {}`)

frontend/early-errors.ts is a preflight walk over JavaScript sources, so a
rejected program fails where a tsc parse error fails, before any lowering.
A case block is one lexical scope across its clauses; a list's
VarDeclaredNames reach into nested blocks but never into a function or a
class body; and Annex B's allowances are honored exactly: two plain
function declarations may repeat in a sloppy block (B.3.3.1), and a plain
function may be an if/else body or a labelled statement in sloppy code
(B.3.2) — an async function, a generator or a class never gets either
allowance, and neither does any function as a loop or 'with' body.

Strictness comes from Node's own module classification (isNodeEsmFile7),
not from the checker's external-module bit: moduleDetection=force gives
every file module scope, CommonJS included, and taking that bit as
strictness cost the Annex B exemption on the annexB
function-redeclaration tests. Typed sources are untouched — their checker
diagnostics (TS2451 and friends) remain the gate, and re-reporting a
collision under a second code would only duplicate them.

tests/test262/support.mjs counts one of these codes at a location inside
the test's own source as the parse-negative match, the same standard the
helper already applies to tsc's early errors. The diagnostics fixtures pin
both families, including the strict half of SC0007 where Node refuses the
two Annex B shapes as well.

The pass only reads the AST and only refuses programs, so no typed
program's IR changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 05:34:47 -07:00
Malte UblandClaude Opus 5.5 a4c19ae4b4 Host the bare compareArray from the upstream assert.js harness
harness/assert.js defines `compareArray(a, b)` beside `assert`: a plain
function that RETURNS a boolean, whose throwing counterpart is
`assert.compareArray` (already hosted). The adapter now injects the bare
name into every prepared test and implements the upstream comparison:
read both `.length`s, so a nullish operand throws the same TypeError,
return false on a length mismatch, otherwise compare elements by
SameValue.

That also admits the compareArray.js include when the only use is a
direct call. A value reference or property read stays excluded, because
it would need the upstream function object and its `format` expando.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 05:34:44 -07:00
Chris Tate 7405e93e56 Convert compareArray's message only when the arrays differ 2026-10-24 16:16:23 -05:00
Chris Tate 1d1fccccd5 Compare identical references and accept any message in the test262 adapter
assert.sameValue, assert.notSameValue and assert.compareArray elements treat identical references as the same value and a reference as different from every primitive. Only two distinct references still refuse, because a conversion at the native boundary can copy a reference but never merge two. Assertion messages may be any value and convert with String, as in the upstream helpers.
2026-10-24 05:56:14 -05:00
Chris Tate 89d122574f Run Test262 tests that include testTypedArray.js 2026-10-23 14:27:20 -05:00
Chris Tate 7e6294ca0f Make scriptc compilation native-only 2026-10-12 12:25:30 -05:00
Chris Tate 3f66c8e20b Make LLVM the sole production backend
- Remove C emission, debugging options, and automatic backend fallback.
- Complete LLVM lowering and native bootstrap coverage across supported targets.
- Link executables and libraries with precompiled C runtime packs, including iOS and Android.
2026-09-29 20:54:09 -05:00
Chris Tate 2b8756077f Adapt property descriptor checks for static Test262 (#553)
* Adapt property descriptor checks for static Test262

* Record preflight baselines for new corpus fixtures
2026-09-28 15:21:34 -05:00
Chris Tate 94f0892e6a Admit direct arguments reads in Test262 scripts (#536)
* Admit direct arguments reads in Test262 scripts

* Record TypeScript parity for recent corpus cases
2026-09-28 11:46:27 -05:00
Chris Tate f7d217f0d5 Support native ReferenceError, EvalError, and URIError (#501)
* Support additional native Error subclasses

* fix error identity across island callback bridge

* record new Error family parity entry
2026-09-27 20:27:50 -05:00
Chris Tate 04aa42354c Support static for-await over synchronous arrays (#498)
* Support synchronous arrays in for-await loops

Drive array values through async-from-sync timing, including promise values and early iterator close. Handle defaulted union destructuring into checked-dynamic bindings and refuse void callback parameters before native code generation. Add differential coverage and pinned async Test262 regressions with original-source completion checks.

* Fix Error subclass C calls and diagnostics snapshot
2026-09-27 19:00:17 -05:00
Chris Tate 13234396c2 Admit receiver-bound this in static Test262 scripts (#495)
* Admit receiver-bound this in static Test262 scripts

* Refresh Set seed diagnostic snapshot
2026-09-27 15:36:42 -05:00
Chris Tate d714819bbf Recognize additional JavaScript early errors in Test262 runner (#494) 2026-09-27 13:44:13 -05:00
Chris Tate 34edee1d08 Expand static Test262 execution for sloppy scripts and parse negatives (#490) 2026-09-27 11:23:06 -05:00
Chris Tate 3d04a561ef Expand static Test262 execution and exception behavior (#486)
* Expand static Test262 harness and exception semantics

* Ignore ASan fiber warning in dev source test

* Refresh TS7 parity baselines after main rebase
2026-09-27 09:21:29 -05:00
Chris Tate 1f23c28bb0 Expand static Array flat, splice, and join lowering (#460)
* Expand static Array flattening, splice insertion, and join coercion

* Refresh Array diagnostic and TypeScript 7 baselines
2026-09-26 08:41:06 -05:00
Chris Tate fc2569ef89 Lower Object prototype tags and own-property calls in static mode (#458)
* Lower static Object prototype tags and own-key calls

* Handle checked-dynamic own keys for strings and bytes

* Record order-parity baselines for Object fixtures
2026-09-26 00:21:19 -05:00
Chris Tate 183a0bbcec Lower static Array fill/copyWithin and position coercion (#457)
* Coerce static Array slice and splice positions

* Lower static Array fill and copyWithin with Test262 assertions
2026-09-25 23:17:24 -05:00
Chris Tate baef5fed29 Handle primitive Array relative indexes in static mode (#456)
* Handle primitive Array relative indexes in static mode

* Record TS7 parity for Array index fixture
2026-09-25 22:21:49 -05:00
Chris Tate c92fdceedd Support static String.prototype.at and codePointAt (#454)
* Support static string at and codePointAt

* Update static at diagnostics and island contracts
2026-09-25 21:34:21 -05:00
Chris Tate 894d687037 Support static string split argument coercion (#452)
* Support static string split argument coercion

* Record split fixture preflight baseline
2026-09-25 20:52:01 -05:00
Chris Tate 413c4a7811 Handle static string padding coercion and ordering (#451) 2026-09-25 19:49:08 -05:00
Chris Tate a7d2da5726 Lower direct String calls on wrappers and plain objects (#450) 2026-09-25 19:09:25 -05:00
Chris Tate d51aa96290 Lower static String prototype call forms (#448) 2026-09-25 18:38:10 -05:00
Chris Tate 86ee43e1b1 Handle scalar repeat counts in static string calls (#446) 2026-09-25 17:32:37 -05:00
Chris Tate 951b8bc4e4 Handle scalar unions in static Number conversion (#444) 2026-09-25 16:59:58 -05:00
Chris Tate a9d68b8e87 Handle nullish Number conversion in static mode (#443) 2026-09-25 15:42:14 -05:00
Chris Tate cd6095b1a0 Preserve object literals in static string search coercion (#441) 2026-09-25 14:11:53 -05:00
Chris Tate cf1071e49f Handle omitted and primitive string search values in static calls (#435) 2026-09-25 12:01:51 -05:00
Chris Tate 665f0fe647 Handle omitted and primitive string lastIndexOf search values (#429) 2026-09-25 11:23:05 -05:00
Chris Tate 965f8b72c8 Handle omitted Array.includes search values in static mode (#427) 2026-09-25 10:29:19 -05:00
Chris Tate 9282ed542a Implement static array lastIndexOf search (#426)
* Implement static array lastIndexOf search

* Coerce dynamic string-search needles before positions

* Handle optional string-search needles with positions
2026-09-25 10:04:33 -05:00
Chris Tate 2367c081bf Handle coerced positions in static string search calls (#424)
* Coerce static string search positions

* Record TypeScript parity for string search fixture
2026-09-25 08:30:18 -05:00
Chris Tate 93af33085e Handle positioned string affix calls in static mode (#421)
* Handle positioned string affix calls in static mode

* Record preflight baselines for string affix fixtures
2026-09-25 07:58:24 -05:00
Chris Tate 858f0002a2 Handle positioned lastIndexOf calls in static mode (#417)
* Handle static lastIndexOf position semantics

* Record TS7 baseline for positioned string search corpus

* Stabilize HTTP timeout differential fixtures

* Order proxy fixture server shutdown
2026-09-25 01:16:16 -05:00
Chris Tate d8f6d7cf94 Fix static string position defaults and coercion (#416)
* Fix static string position defaults and coercion

* Stabilize HTTP timeout differential fixtures
2026-09-25 00:42:37 -05:00
Chris Tate 5c557d8ea4 Fix static JavaScript edge cases and add Test262 coverage (#414) 2026-09-24 23:01:48 -05:00