Commit Graph

48 Commits

Author SHA1 Message Date
oxc-guard 7ebbdddce7 chore(submodules): update submodule SHAs to latest commits (#25505)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `b363f29` → `be13516`
- babel: `06b6eae` → `1eac448`
- estree-conformance: `f7a4e0c` → `8d4e1fa`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2026-08-11 16:17:31 +00:00
Dunqing 66cfe0a49a chore(coverage): update stale test262 runtime snapshot (#25471)
The automated submodule bump #25261 regenerated `runtime.snap` on a loaded CI runner where two tests hit the global timeout, recording transient `timeout: global` failures (`expressions/arrow-function/name.js`, `function-code/10.4.3-1-13-s.js`) and dropping the pass count from 17306 to 17304. Both tests pass on a normal run, so monitor-oxc's Test262 drift check has failed on every run since ([example](https://github.com/oxc-project/monitor-oxc/actions/runs/31359248351/job/93364683855)).

This restores the snapshot to what `cargo coverage runtime` actually produces. Rather than regenerating locally (which could bake in this machine's own timeouts), the CI-reported diff was applied directly and verified byte-identical to CI's output (`git hash-object` matches the diff's `65e3fa9` blob).

Timeouts can get baked in again whenever an automated regen lands on a slow runner; retrying timed-out tests before recording them would close that hole and is left for a follow-up.

This PR was assisted by Claude.
2026-08-10 10:16:19 +00:00
oxc-guard[bot] 4e7007118d chore(submodules): update submodule SHAs to latest commits (#25261)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `d1d583d` → `b363f29`
- babel: `c86e9e4` → `06b6eae`
- TypeScript: `637d574` → `b465fdb`
- estree-conformance: `e8fd120` → `f7a4e0c`


This PR is automatically generated by the [update_submodules
workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).

Co-authored-by: oxc-guard[bot] <276638029+oxc-guard[bot]@users.noreply.github.com>
2026-08-03 22:09:18 +01:00
Dunqing 4279ecaa7c chore(coverage): update stale test262 runtime snapshot (#24528)
#24463 moved the test262 pin from `de8e621c` to `d1d583db` but did not regenerate `tasks/coverage/snapshots/runtime.snap`, which still records the old sha. The runtime suite doesn't run in repo CI, so nothing caught it; monitor-oxc's Test262 job has been aborting on the snapshot sha guard ("Repository … is outdated for runtime.snap. Please run `just submodules`") on every run since 2026-07-13.

Two changes:

1. Regenerated the snapshot with `UPDATE_SNAPSHOT=1 cargo coverage runtime` against the pinned checkout: 17306/18277 (94.69%) passing, matching what monitor-oxc measures on main. The list changes are upstream test262 churn — two new `eval-code` global-function-init failures, and the async-arrow `forbidden-ext` block that no longer exists upstream.

2. Fixed the root cause of the staleness: the `update_submodules` workflow runs `just coverage`, whose default task skips the runtime suite, so `runtime.snap` was never regenerated on automated pin bumps. The workflow now runs `cargo coverage runtime` explicitly (it already sets up Node).

This PR was assisted by Claude.
2026-07-15 01:43:09 +00:00
Dunqing 7d3336365d fix(minifier): preserve guaranteed throws from class heritage evaluation (#24349)
Evaluating a class declaration can throw before any of its members matter. `class C extends C {}` reads its own name while it is still in the TDZ and always throws a ReferenceError. A heritage that is a `var`, or a lexical binding declared later, can be undefined or uninitialized at evaluation time and throws a TypeError. The minifier only checked for a literal arrow function as heritage, so removing an unused class could silently delete one of these guaranteed throws.

The removal check now unwraps parens and sequence wrappers before looking at the heritage, and keeps any class whose heritage identifier resolves to a class, `let`/`const`, or `var` binding. Declaration order cannot be proven in the middle of minification (transforms copy and move spans), so the rule is conservative on purpose. Function declarations, imports, and globals are initialized before any class can evaluate, so classes extending them can still be removed.

## Example

```js
var f = () => {};
class C extends f {}
```

Running this throws `TypeError: Class extends value ... is not a constructor`.

Before, the unused class was removed and the whole program minified to nothing, so the TypeError was gone. After, the output is unchanged and the throw is preserved:

```js
var f = () => {};
class C extends f {}
```

This fixes six test262 runtime failures that exist on main today (17279 -> 17285 positive passes): `in-extends-expression-grouped`, `in-extends-expression-assigned`, `superclass-arrow-function`, `prototype-getter`, `prototype-setter`, and `constructable-but-no-prototype`. The runtime suite executes the minified tests in node; the results were verified through monitor-oxc. Minified sizes are unchanged on every fixture.

Implemented with AI assistance (Claude Code); design, review, and verification driven by the author per the repo AI-usage policy.
2026-07-11 14:43:07 +00:00
Dunqing 9d09a875b5 test(coverage): reimplement test262 runtime execution (#24034)
## Summary

#18478 reduced the test262 runtime runner to a stub ("not yet implemented"), and since oxc's own CI never runs `cargo coverage runtime`, the transformer/minifier semantics coverage it provided has been dark — monitor-oxc's Test262 job (the only consumer) has been disabled since July 2025.

This restores execution on the simplified architecture: each eligible test262 case runs through codegen / transform / minify and executes in the Node runtime server, driven by rayon with blocking HTTP instead of the old tokio design. Skip lists and per-variant semantics are ported verbatim from the pre-#18478 runner.

- `main.rs` now loads `TestData` lazily, so `cargo coverage runtime` works with only the test262 fixtures checked out (which is how monitor-oxc CI invokes it).
- Execution is parallelized: one Node server per core with each rayon worker pinned to its own server, and the test262 harness is compiled once per distinct include list as a reusable `vm.Script` instead of re-parsed per request. Full suite: ~10s wall locally (~45s single-server).
- Results at test262 `de8e621c`: 17279/18277 positive tests pass (94.54%); `runtime.snap` is committed and byte-stable across repeated runs; clippy/fmt clean.
- monitor-oxc side: oxc-project/monitor-oxc#178 (must merge after this one).

Note: oxc CI still does not run the runtime suite, so `runtime.snap` can go stale and turn monitor-oxc's job red — the failure mode that led to the original "skip 262". Possible follow-ups: run it in conformance CI, or add a regression-only mode (fail on new failures, tolerate improvements).
2026-07-02 05:35:57 +00:00
camc314 ec463beb63 chore(oxc): remove some unused snapshot files (#17803) 2026-01-09 12:04:41 +00:00
Boshen f897e303eb chore(tasks): update test262, babel and TypeScript (#13217) 2025-08-20 01:22:35 +00:00
Boshen f46818ad70 feat(minifier): remove unused class expression (#12618)
Also improved removable of unused class declaration.

closes #11454
2025-07-30 12:29:03 +00:00
Boshen fe9c8e14b1 fix(minifier): do not remove non-plain empty functions (#12573)
Do not remove empty function calls if the function is async or generator or args can cause type error.

From test262:

```js
function fn({}) {}

assert.throws(TypeError, function() {
  fn(null);
});
```
2025-07-28 12:54:43 +00:00
Boshen 13825c03bc chore(coverage): bump test262, babel and typescript versions (#11163) 2025-05-20 01:51:51 +00:00
Boshen 0f750e2c2f chore(coverage): update runtime.snap (#10631) 2025-04-27 05:03:14 +00:00
Boshen a359e8e517 chore: update Babel and TypeScript (#9462) 2025-03-01 21:09:33 +08:00
Boshen dde05e3d97 feat(mangler): opt-out of direct eval (#9191)
Context:

* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
* https://esbuild.github.io/content-types/#direct-eval
2025-02-18 10:31:24 +00:00
Dunqing f5c5c3c9f1 chore(coverage/runtime): skip tests which are eval in class (#8532)
These tests need performing `eval`, we cannot support them. @overlookmotel and I have agreed to ignore them to reduce the noise.
2025-01-16 05:44:32 +00:00
Dunqing 06ccb51fae fix(transformer/async-to-generator): move parameters to the inner generator function when they could throw errors (#8500)
The new implementation port from [esbuild](https://github.com/evanw/esbuild/blob/df815ac27b84f8b34374c9182a93c94718f8a630/internal/js_parser/js_parser_lower.go#L355-L467), before from `Babel`.

Babel's transform implementation for the async method is incorrect because the async method should return a rejecting promise when it throws an error. Everything is good if the errors are thrown in the async method body, but the following case will throw an error in the parameters which causes the whole program crushed not a rejecting promise. So we should move the parameters to the inner generator function when the parameters could throw an error.

Input:
```js
class Cls {
  // ReferenceError: Cannot access 'b' before initialization
  async method(a = b, b = 0) {}
}
```

Before output
```js
class Cls {
  method(a = b, b = 0) {
    return babelHelpers.asyncToGenerator(function* () {})();
  }
}
```

After output:
```js
class Cls {
  method() {
     // ReferenceError: Cannot access 'b' before initialization
    return babelHelpers.asyncToGenerator(function* (a = b, b = 0) {}).apply(this, arguments);
  }
}
```

No override tests because Babel doesn't cover this case.
2025-01-16 00:18:05 +00:00
Dunqing 31746754a8 chore(coverage): update runtime snapshots (#8489)
Found a bunch of failed tests related to we don't use
`classPrivateSetter` and `classPrivateGetter` to transform private
getter and private setter. The simplest way is to add alternative helper
functions for these two. The reason we don't use I have explained in
#8132

```shell
tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «0») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «15») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «257») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «0.5») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1000») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «96») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «6») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «3») to be true

tasks/coverage/test262/test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js
transform error: Test262Error: The expression should evaluate to the result Expected SameValue(«undefined», «1») to be true
```
2025-01-14 22:06:10 +08:00
Boshen 8b025e36db chore(coverage): bump test262 (#8055) 2024-12-21 10:20:14 +00:00
Boshen 99a431be74 fix(coverage): make coverage runtime timeout stable (#7953)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-17 12:02:56 +08:00
Boshen 7610dc19ff fix(parser): parse import source from 'mod' (#7833) 2024-12-13 10:26:36 +00:00
Boshen 66a680a119 deps(coverage): bump test262 (#7695) 2024-12-06 14:34:01 +08:00
Boshen ed6a69e2db chore(coverage): update runtime.snap 2024-11-25 22:36:05 +08:00
Boshen 224775c056 feat(transformer): transform object rest spread (#7003)
https://babel.dev/docs/babel-plugin-transform-object-rest-spread
2024-11-21 11:33:26 +00:00
Boshen 7b83a3ddfa chore(tasks/coverage): update runtime.snap 2024-11-18 18:01:49 +08:00
7086cmd cf99be0a0d fix(minifier): do not compare bigint with object (#7294)
@Boshen, could you please update the snap of runtime and commit to this PR? I want to see the effects after the unit tests are added.
2024-11-16 06:01:06 +00:00
Boshen 8d8f34cfb5 chore(tasks/coverage): update runtime.snap 2024-11-15 12:48:56 +08:00
Boshen 4bef99c80b chore(coverage): update runtime snapshot 2024-11-01 13:05:42 +08:00
Boshen b518670582 chore(coverage): remove known runtime issues 2024-10-28 21:38:37 +08:00
Boshen a47c70e425 fix(minifier): fix remaining runtime bugs (#6855) 2024-10-24 12:22:18 +00:00
Boshen 686727fc96 fix(minifier): reference read has side effect (#6851) 2024-10-24 08:32:38 +00:00
Dunqing 076f5c39f4 fix(transformer/typescript): retain ExportNamedDeclaration without specifiers and declaration (#6848)
close: #6825
2024-10-24 07:59:07 +00:00
Boshen fd57e00108 feat(ecmascript): add abstract_relational_comparison to dce (#6846)
I removed bigint comparisons because they were incorrect
2024-10-24 06:46:07 +00:00
Boshen ca799936b0 fix(minifier): do not dce object literals yet (#6839)
closes #6769
2024-10-24 01:05:07 +00:00
Boshen ec5a19b880 fix(minifier): do not remove binary expressions (#6829) 2024-10-23 16:07:29 +00:00
Boshen 22355f73f3 fix(minifier): do not remove undefined for destructuring patterns (#6828) 2024-10-23 15:42:04 +00:00
Boshen 088c1b6460 fix(coverage): turn off mangle for runtime test (#6827) 2024-10-23 15:05:36 +00:00
Boshen 7291f71019 fix(coverage): enable only_remove_type_imports for runtime transform test (#6826) 2024-10-23 14:26:48 +00:00
Boshen 11077708bb fix(coverage): inject babel helpers for transform (#6818) 2024-10-23 12:43:56 +00:00
Boshen 4757376136 fix(coverage): omit explicit-resource-management from runtime test (#6804) 2024-10-23 07:49:01 +00:00
Boshen 05ef03dbab fix(codegen): correct print __proto__ shorthand (#6802) 2024-10-23 07:16:00 +00:00
Boshen 1b7897cf01 fix(codegen): print #field in {} << 0; correctly (#6799) 2024-10-23 05:34:22 +00:00
Boshen 2f6ad42348 fix(codegen): print negative bigint 1n- -1n correctly after constant folding (#6798)
closes #6767
2024-10-23 04:56:50 +00:00
Boshen 8f179534c2 fix(coverage): remove some broken cases (#6797) 2024-10-23 03:10:49 +00:00
Boshen 9c7ae78c75 fix(coverage): better handling of test262 failling cases (#6794) 2024-10-23 02:02:18 +00:00
Boshen ffa3945465 chore(coverage): ignore v8 failed cases from runtime.snap (#6780) 2024-10-22 16:21:42 +00:00
Boshen e15b7ce09c fix(coverage): tests for --> in the first line should not have raw flag. (#6772) 2024-10-22 10:24:27 +00:00
Boshen 70efa47d75 fix(coverage): turn off refresh plugin in runtime test (#6749) 2024-10-21 15:53:29 +00:00
Boshen 112580a408 feat(coverage): add transformer and minifier to runtime test (#6734)
closes #6578
2024-10-21 08:55:29 +00:00