Commit Graph

121 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
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
camc314 9fbbaf8607 fix(parser): clarify return in class static blocks (#24899)
## Summary

- report TypeScript diagnostic TS18041 for `return` statements in class static initialization blocks
- reuse the existing `NewTarget`/`Return` parser-context invariant without adding a new context flag
- update the TypeScript, Babel, and Test262 parser snapshots

## Root cause

Class static blocks disable the parser's `Return` context, so their `return` statements previously fell through to the generic top-level TS1108 diagnostic. Static blocks already enable `NewTarget`, which distinguishes this case when `Return` is absent.
2026-07-24 14:26:41 +00:00
camc314 3048594401 fix(parser): use correct diagnostic for await using in bare switch case (#24798)
This improve the error diagnostic for await using in bar switch case clauses, as well as aligning more closely with  the behaviour for using/await using in ambient contexts:

https://github.com/oxc-project/oxc/blob/981a9522f5fb658943e89501b35543ff3283eea5/crates/oxc_parser/src/js/declaration.rs#L197-L204
2026-07-22 09:04:49 +00:00
camc314 ddacf617f1 feat(semantic): add context notes for strict assignments (#24728)
## Summary

Adds context notes to `Cannot assign to '{x0}' in strict mode` diagnostics, explaining whether strict mode comes from an explicit directive, class body, or module.
2026-07-20 17:17:30 +00:00
camc314 cc3d17f063 feat(semantic): add context notes for reserved keyword diagnostic (#24715)
## Summary

Reserved-keyword diagnostics now explain the language context that makes an identifier invalid, rather than only reporting that the keyword is reserved.

## Details

- Add context-aware notes for strict mode, classes, and modules.
- Add a dedicated note for `await` in module code.
- Update parser-conformance snapshots for the expanded diagnostics.

Before:

```text
× The keyword 'package' is reserved
```

After, for strict-mode code:

```text
× The keyword 'package' is reserved
note: This identifier is reserved in strict mode code
```

After, for class code:

```js
class Example {
  method() {
    const static = 1;
  }
}
```

```text
× The keyword 'static' is reserved
note: Classes are always strict mode code
```

After, for module code:

```js
export const await = 1;
```

```text
× The keyword 'await' is reserved
note: The identifier `await` is reserved in module code
2026-07-20 10:59:00 +00:00
sapphi-red 4c71560a72 feat(parser): more friendly error for spread element in dynamic imports (#24705)
This PR makes parse error message for spread element in dynamic imports more friendly.

**Before**
```
  × Unexpected token
   ╭─[babel/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/input.js:1:8]
 1 │ import(...[1])
   ·        ───
   ╰────
```
**After**
```
  × TS(1325): Argument of dynamic import cannot be a spread element.
   ╭─[babel/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/input.js:1:8]
 1 │ import(...[1])
   ·        ───
   ╰────
```
2026-07-20 08:23:46 +00:00
camc314 129b759131 feat(parser): improve diagnostics for unparenthesized LHS on exponential expr (#24569)
## Summary

- Report operator-specific diagnostics when unary and `await` expressions are used as exponentiation left operands.
- Reject unparenthesized TypeScript type assertions in the same position while preserving explicitly parenthesized forms.
- Add regression fixtures and update the affected conformance snapshots.
2026-07-15 18:38:30 +00:00
camc314 7b4baff16c fix(parser): reject new import member access (#23459)
Reject `new import(...).prop`, `new import.source(...).prop`, and `new import.defer(...).prop` by treating member access on an unparenthesized import expression as invalid after `new`.

Fixes #23458
2026-07-15 10:38:34 +00:00
oxc-guard[bot] 17cb5c13c5 chore(submodules): update submodule SHAs to latest commits (#24463)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `de8e621` → `d1d583d`
- babel: `1fb0b77` → `c86e9e4`
- TypeScript: `7964e22` → `637d574`
- estree-conformance: `6514ad7` → `e8fd120`


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-07-13 14:24:36 +01:00
oxc-guard 9e72aa0312 chore(submodules): update submodule SHAs to latest commits (#23451)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `05bb032` → `de8e621`
- babel: `2688fbd` → `1fb0b77`
- TypeScript: `7539c04` → `7964e22`
- estree-conformance: `ca42c3d` → `6514ad7`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2026-06-15 14:31:01 +00:00
camc314 e5050c082d feat(parser): improve diagnostic for rest initializer (#23205)
This improves the readability of parser diagnostics by distinguishing rest parameter initializer errors from rest binding element initializer errors.
2026-06-10 08:14:58 +00:00
oxc-guard b4f9cb9d8c chore(submodules): update submodule SHAs to latest commits (#23118)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `7e115f4` → `05bb032`
- babel: `d9fe348` → `2688fbd`
- TypeScript: `e5509e2` → `7539c04`
- estree-conformance: `faf089d` → `ca42c3d`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2026-06-08 14:49:36 +00:00
Boshen 1295882c65 fix(parser): report new.target and import.meta syntax errors in the parser (#23003)
## What

Move the `MetaProperty` early-error checks from the semantic checker (`oxc_semantic`) into the parser:

- **`new.target` outside a valid context** — e.g. at the top level, in a top-level arrow, or in a computed class-member key.
- **`import.meta` outside a module** — i.e. in script / CommonJS code.

Consumers that only run the parser (without `SemanticBuilder`) now get these diagnostics.

## How

- `new.target` validity is tracked with a new inherited `Context::NewTarget` flag (widening `Context` from `u8` to `u16`). The flag is *added* by three constructs — a regular (non-arrow) function's parameters + body, a class static block, and a class field initializer — and *inherited* through arrow functions and class bodies. This naturally models the spec rule, including cases like `function g(){ class D { [new.target](){} } }` (valid, inherits `g`'s context).
- `import.meta` reuses the existing `error_on_script` deferral, so in unambiguous source `visit_import_meta` marks the file a module and the deferred error is discarded.
- `check_meta_property` and its now-unused diagnostics are removed from `oxc_semantic`.

## Spec correctness

Verified all cases against V8 (Node v24). One behavior change vs. the old semantic checker: a computed class **field** key such as `class C { [new.target] = 1 }` at the top level is now correctly a **SyntaxError**, matching V8 — the old checker accepted it due to a coarse `PropertyDefinition` AST-ancestor match.

| Source | V8 | this PR |
| --- | --- | --- |
| `new.target;` | SyntaxError | error |
| `function f(){ new.target; }` | ok | ok |
| `() => new.target;` | SyntaxError | error |
| `class C { x = new.target; }` | ok | ok |
| `class C { static { new.target; } }` | ok | ok |
| `class C { [new.target] = 1; }` | SyntaxError | error |
| `class C { [new.target](){} }` | SyntaxError | error |
| `function g(){ class D { [new.target](){} } }` | ok | ok |
| `import.meta` in script | SyntaxError | error |
| `import.meta` in module | ok | ok |

Parser & semantic conformance remain 100% positive / 100% negative on test262; all unit tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-06-06 07:35:41 +00:00
oxc-guard[bot] 50baca037c chore(submodules): update submodule SHAs to latest commits (#22721)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `78fc3f8` → `7e115f4`
- babel: `3d34928` → `d9fe348`
- TypeScript: `f350b52` → `e5509e2`
- estree-conformance: `576e7d8` → `faf089d`


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-05-25 22:16:39 +08:00
sapphi-red 661132d5ac feat(parser): more friendly error messages for rest assignment target and rest binding element (#22719)
Made the errors for `({...[]} = {});` and `const {...[]} = obj;` a bit more easier to understand:

```
  × Invalid rest element target in destructuring assignment
   ╭─[misc/fail/rest-assignment-target.js:1:6]
 1 │ ({...[]} = {});
   ·      ──
   ╰────
  help: Expected an identifier or member expression, like `...rest` or `...obj.prop`.
```

```
  × Invalid rest element target in destructuring pattern
   ╭─[misc/fail/rest-binding-element.js:1:11]
 1 │ const {...[]} = obj;
   ·           ──
   ╰────
  help: Expected an identifier, like `...rest`.
```
2026-05-25 12:47:34 +00:00
camc314 e184f74d11 fix(parser): improve invalid import property access diagnostic (#22693)
This improves the parser diagnostic for invalid `import.<property>` access.

Previously, invalid properties like `import.sync("baz")` were reported as if only `import.meta` were valid, which is misleading now that `import.source()` and `import.defer()` are also supported.

Before:

```text
  × The only valid meta property for import is import.meta
    ╭─[index.ts]
 37 │
 38 │ import.foo();
      ──────────
 39 │
    ╰────
```

After:

```text
  × The only valid property accesses on import are `import.meta`, `import.source()`, and `import.defer()`
    ╭─[index.ts]
 37 │
 38 │ import.foo();
      ──────────
 39 │
    ╰────
```

Also adds a coverage fixture for the `import.sync("baz")` case and updates the parser coverage snapshots.
2026-05-25 09:58:50 +00:00
oxc-guard[bot] ec7de07b08 chore(submodules): update submodule SHAs to latest commits (#22550)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `ccaac10` → `78fc3f8`
- babel: `4079bcd` → `3d34928`
- estree-conformance: `9c67f5e` → `576e7d8`


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-05-19 10:46:02 +08:00
oxc-guard e68f4fa1c3 chore(submodules): update submodule SHAs to latest commits (#22417)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `d0c1b45` → `ccaac10`
- babel: `6402dbb` → `4079bcd`
- estree-conformance: `d968f2c` → `9c67f5e`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2026-05-14 10:36:57 +00:00
oxc-guard[bot] 550052a096 chore(submodules): update submodule SHAs to latest commits (#22170)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `2b2ecea` → `d0c1b45`
- babel: `c543b03` → `6402dbb`
- TypeScript: `c7a0ae1` → `f350b52`
- estree-conformance: `e4104a1` → `d968f2c`


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-05-06 09:19:12 +01:00
Boshen 3fca6febc6 chore(submodules): update submodule SHAs to latest commits (#21455)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `ff0d161` → `2b2ecea`
- babel: `91b4ce3` → `c543b03`
- TypeScript: `7b8cb3b` → `c7a0ae1`
- estree-conformance: `d5e48e7` → `e4104a1`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2026-04-15 09:08:25 +00:00
Boshen 5f6ce21874 chore(submodules): update submodule SHAs to latest commits (#21105)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `5c82069` → `ff0d161`
- babel: `0124e7c` → `91b4ce3`
- TypeScript: `4f7b417` → `7b8cb3b`
- estree-conformance: `dc0f79b` → `d5e48e7`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2026-04-07 06:54:12 +00:00
Boshen 75f4a3e593 chore(submodules): update submodule SHAs to latest commits (#20651) 2026-03-23 18:23:15 +08:00
Boshen f42be37c91 chore(submodules): update submodule SHAs to latest commits (#20518)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `63829c6` → `3a9ecbe`
- babel: `87a048d` → `31b3d95`
- TypeScript: `c9e7428` → `9059e5b`
- estree-conformance: `4daa9d7` → `9a4ddfb`


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: Boshen <1430279+Boshen@users.noreply.github.com>
2026-03-20 13:13:40 +08:00
Boshen 7e83da9f2f chore(submodules): update submodule SHAs to latest commits (#20268) 2026-03-12 19:07:19 +08:00
Boshen f467298373 chore(submodules): update submodule SHAs to latest commits (#19951) 2026-03-06 14:45:41 +08:00
Boshen 6a59a76961 fix(parser): improve error recovery for private identifiers in property names (#19710)
## Summary

- When `#ident` appears as a property key in invalid positions (object literals `{#x: 1}`, destructuring `const {#x} = y`, TS interface members), the parser previously fell into `parse_identifier_name()` producing an unhelpful "Unexpected token" error
- Added a `Kind::PrivateIdentifier` arm in `parse_property_name()` that creates a proper `PropertyKey::PrivateIdentifier` AST node and emits "Private identifier '#x' is not allowed in property names"
- This works correctly both inside and outside class bodies, with no conformance regressions

closes #19669

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-02-25 11:49:16 +00:00
Boshen 529fbac105 chore(submodules): update submodule SHAs to latest commits (#19662) 2026-02-24 15:34:23 +08:00
copilot-swe-agent 655c38fa38 feat(semantic): add "did you mean?" suggestions to undefined name errors (#19102)
## Improve `undefined_export` and related errors with name suggestions

This PR adds helpful "did you mean?" suggestions to errors where names are not found, using Levenshtein distance (threshold=2).

### Example Output

**undefined_export with suggestion:**
```
Export 'myVarible' is not defined
help: Did you mean 'myVariable'?
```

**private_field_undeclared with suggestion:**
```
Private field '#privateFild' must be declared in an enclosing class
help: Did you mean '#privateField'?
```

**invalid_label_target with suggestion:**
```
Use of undefined label
help: Did you mean 'outerLoop'?
```

### Implementation Details

- Moved Levenshtein edit distance calculation from `oxc_linter` to `oxc_span` for reuse across crates
- Uses a threshold of 2 for edit distance to suggest similar names
- Collects available names from appropriate scopes only when errors are found (performance optimization)

<!-- START COPILOT CODING AGENT SUFFIX -->

<!-- START COPILOT ORIGINAL PROMPT -->

<details>

<summary>Original prompt</summary>

> Improve `undefined_export` and some other errors to include a hint that suggests similar names that are defined

</details>

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.
2026-02-24 06:27:10 +00:00
camc314 08b0218dd6 chore(submodules): update submodule SHAs to latest commits (#19518) 2026-02-18 14:56:36 +00:00
Boshen 333d4fb167 chore(submodules): update submodule SHAs to latest commits (#18841)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `fff41f0` → `dd6138f`
- babel: `6ef16ca` → `92c052d`
- TypeScript: `7f6a846` → `95e3aaa`
- estree-conformance: `389cb2a` → `6611520`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2026-02-03 04:30:00 +00:00
camc314 8d68e9aceb fix(parser,semantic): revert adding ts error codes to diagnostics (#18571) 2026-01-26 09:17:17 +00:00
camc314 0a02026502 feat(semantic): add TS1499 code to diagnostic (#18557)
https://github.com/microsoft/typescript/blob/7affa9e5403035b6d281616e6651529e7387f253/src/compiler/diagnosticMessages.json#L1659-L1662
2026-01-26 02:30:26 +00:00
camc314 8b4618f371 feat(parser): add TS1500 code to diagnostic (#18547)
https://github.com/microsoft/typescript/blob/7affa9e5403035b6d281616e6651529e7387f253/src/compiler/diagnosticMessages.json#L1663-L1666
2026-01-26 02:22:57 +00:00
camc314 866b6b3edd feat(parser): add TS1048 code to diagnostic (#18546)
https://github.com/microsoft/typescript/blob/7affa9e5403035b6d281616e6651529e7387f253/src/compiler/diagnosticMessages.json#L142-L145
2026-01-25 15:08:46 -05:00
camc314 1117c446a0 feat(parser): add TS1054 code to diagnostic (#18541)
https://github.com/microsoft/typescript/blob/7affa9e5403035b6d281616e6651529e7387f253/src/compiler/diagnosticMessages.json#L162-L165
2026-01-25 19:42:43 +00:00
camc314 51d3b3f4c4 feat(parser): add TS1502 code to diagnostic (#18534)
https://github.com/microsoft/typescript/blob/16b933fb7bff04371fe9ec8525a8e90afa3174d4/src/compiler/diagnosticMessages.json#L1671-L1674
2026-01-25 18:32:17 +00:00
camc314 00854e8609 feat(semantic): add TS2337 error code to super call diagnostic (#18531) 2026-01-25 18:00:55 +00:00
camc314 74d09983a1 fix(semantic): update error msg for multiple default cases in switch stmt (#18526) 2026-01-25 18:00:55 +00:00
Boshen aed3669a02 fix(parser): parse HTML-like comments in unambiguous mode (#18442)
## Summary

Closes #18392

Support HTML-like comments (`<!--` and `-->`) per ECMAScript Annex B.1.1:

- **Script/CommonJS mode**: HTML comments recognized as single-line comments
- **Unambiguous mode (.js)**: HTML comments recognized; error deferred until ESM syntax detected
- **Module mode (.mjs)**: HTML comments at start of line emit "HTML comments are not allowed in modules" error; `<!--` in middle of expression (e.g. `foo <!--bar`) parses as operators

This enables proper detection of HTML comment injection vectors in security tools like [AikidoSec/zen-internals](https://github.com/AikidoSec/zen-internals/pull/125).

🤖 Generated with [Claude Code](https://claude.ai/code)
2026-01-23 11:35:33 +00:00
Boshen b225b29cc1 chore(submodules): update submodule SHAs to latest commits (#18334)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `6f55d0c` → `fff41f0`
- babel: `fc58af4` → `6ef16ca`
- TypeScript: `f5ccf43` → `7f6a846`
- estree-conformance: `4980d9b` → `389cb2a`

This PR is automatically generated by the [update_submodules workflow](https://github.com/oxc-project/oxc/blob/main/.github/workflows/update_submodules.yml).
2026-01-22 16:13:31 +00:00
Boshen 60379958cd fix(semantic): allow new.target in class field initializers (#18349)
## Summary

- Allow `new.target` in class field initializers per the ES2022 spec
- `new.target` evaluates to `undefined` in this context, same as in static blocks
- This aligns Oxc with Babel's behavior

## Background

TypeScript incorrectly disallows `new.target` in class field initializers. Their validation was implemented in 2016 ([PR #12783](https://github.com/Microsoft/TypeScript/pull/12783)) before class fields were standardized, and was never updated when ES2022 landed.

The ES spec explicitly allows this - see the [TC39 class-fields proposal](https://github.com/tc39/proposal-class-fields) and [Babel issue #6243](https://github.com/babel/babel/issues/6243).

## Test case

```javascript
class X {
  static a = new.target;              // ✓ allowed (evaluates to undefined)
  static b = () => new.target;        // ✓ allowed (arrow inherits from field context)
  e = new.target;                     // ✓ allowed
  f = () => new.target;               // ✓ allowed
}
```

## Test plan

- [x] Babel conformance test `es2022/class-properties/new-target` now passes
- [x] `cargo test -p oxc_semantic --lib` passes
- [x] `just check lint test` passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-21 15:05:55 +00:00
Boshen 2c6966dfe1 fix(parser): correct precedence handling for private-in expression (#18169)
## Summary

- Fix incorrect parsing of `1 + #a in b` which was parsed as `1 + (#a in b)` instead of `(1 + #a) in b`
- Add precedence check before parsing `#a in` as `PrivateInExpression`
- Report "Unexpected private identifier" error when precedence doesn't allow `in` operator

## Details

The parser was greedily parsing `#a in` as a `PrivateInExpression` without checking operator precedence. For example, when parsing the RHS of `+` in `1 + #a in b`, the `in` operator's precedence (`Compare = 13`) is lower than `+`'s precedence (`Add = 15`), so `#a in` should not be parsed as a unit.

The fix extracts private-in parsing into `parse_private_in_expression` and adds a check: if `lhs_precedence >= Precedence::Compare`, we reject the private identifier with a syntax error, matching V8 and Babel behavior.

## Test plan

- `cargo test -p oxc_parser` passes
- Conformance improved: Negative Passed 1648 → 1649 for Babel tests
- `invalid-private-followed-by-in-2` test case now correctly reports syntax error

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-18 07:51:38 +00:00
Boshen 9fff61b940 fix(coverage): skip annexB assignmenttargettype tests in test262 conformance (#18157)
## Summary
- Skip annexB assignmenttargettype tests in test262 conformance suite
- These tests require call expressions to be valid assignment targets in non-strict mode (e.g., `f() = 1`, `f()++`, `for (f() in [1]) {}`)
- This is an Annex B "web reality" feature that oxc intentionally does not support

## Test plan
- [x] `cargo coverage -- parser` shows 100% pass rate (46556/46556)
- [x] All affected snapshots updated

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-01-18 02:09:41 +00:00
Boshen c98e5b77e4 fix(parser): parse for (using of = ...) as using declaration (#18142)
## Summary

- Fix parsing of `for (using of = null;;)` as a using declaration where `of` is the binding identifier
- Previously, the parser incorrectly treated `of` as the keyword starting a for-of loop

The fix uses a lookahead to check if the token after `of` is `=`, `;`, or `:`, matching TypeScript's parser behavior.

## Test plan

- `cargo coverage -- parser` - conformance tests pass
- `cargo test -p oxc_parser` - unit tests pass

🤖 Generated with [Claude Code](https://claude.ai/code)
2026-01-18 00:42:17 +00:00
Boshen 830b757f81 feat(regular_expression): add Unicode 17.0 script properties (#18140)
## Summary

Add support for 4 new scripts introduced in Unicode 17.0:
- `Beria_Erfe` (`Berf`)
- `Sidetic` (`Sidt`)
- `Tai_Yo` (`Tayo`)
- `Tolong_Siki` (`Tols`)

## Test plan

- [x] 8 parser_test262 tests now pass (from 46547 → 46555 positive passed)
- [x] 1 minifier_node_compat test now passes (from 930 → 931 positive passed)
- [x] 8 semantic_test262 tests now pass (from 44911 → 44919 positive passed)
- [x] `cargo test -p oxc_regular_expression` passes

🤖 Generated with [Claude Code](https://claude.ai/code)
2026-01-17 16:47:06 +00:00
Boshen fb181ccdff fix(semantic): error on using at top level in scripts (#18090)
## Summary

- Add check to error on `using` declarations at the top level of scripts
- `using` declarations require block scope semantics and are not allowed
at the top level of scripts

`using` declarations are allowed:
- At the top level of ES modules
- At the top level of CommonJS modules (files are wrapped in a function)
- Inside any block scope in scripts

But NOT at the top level of scripts.

Closes #11862

## Test plan

- [x] Added test case
`tasks/coverage/misc/fail/script-top-level-using.js` for invalid usage
- [x] Added test case
`tasks/coverage/misc/pass/script-using-in-block.js` for valid usage in
block
- [x] All existing tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 12:18:26 +08:00
Boshen 8687b0959f chore(submodules): update submodule SHAs to latest commits (#17978)
Updates submodule dependencies to their latest commits.

## Changes

- test262: `9079aee` → `6f55d0c`
- babel: `761c250` → `fc58af4`
- TypeScript: `f3770c9` → `f5ccf43`
- estree-conformance: `87a8e99` → `4980d9b`


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: Boshen <1430279+Boshen@users.noreply.github.com>
2026-01-14 15:13:29 +08:00
Dunqing 2261e6e65b feat(semantic): improve error message to add # for private identifiers (#17779)
```js
class A {
    #a;
    #a
}
```

Chrome devtool throws:

`VM411:3 Uncaught SyntaxError: Identifier '#a' has already been declared`
2026-01-08 09:06:40 +00:00
camc314 a7e16436da feat(parser): add TS2528 error code to duplicate_default_export diagnostic (#17558) 2026-01-02 12:55:48 +00:00