Skip to content

refactor(diagnostics)!: return a Diagnostics type instead of Vec<OxcDiagnostic>#23217

Merged
graphite-app[bot] merged 1 commit into
mainfrom
refactor/diagnostics-type
Jun 10, 2026
Merged

refactor(diagnostics)!: return a Diagnostics type instead of Vec<OxcDiagnostic>#23217
graphite-app[bot] merged 1 commit into
mainfrom
refactor/diagnostics-type

Conversation

@Boshen

@Boshen Boshen commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

Introduces oxc_diagnostics::Diagnostics — a Vec<OxcDiagnostic> newtype that knows the difference between errors and warnings — and makes it the standard diagnostics return value across oxc.

  • New type: Diagnostics with has_errors(), has_warnings(), errors(), warnings(), plus Vec-like ergonomics (Deref, IntoIterator, Extend, From/Into<Vec>) so most call sites are unchanged.
  • Return types: ParserReturn, SemanticBuilderReturn, IsolatedDeclarationsReturn, the React Compiler TransformResult/LintResult, and TransformerReturn now expose diagnostics: Diagnostics instead of errors: Vec<OxcDiagnostic> (the React Compiler's separate errors/warnings are merged into one severity-tagged list).
  • Behaviour: a React Compiler error now stops the transform (no output), while warnings flow through and the transform continues. compile() aborts codegen only when diagnostics.has_errors() — warnings alone no longer abort (previously any diagnostic did).

Breaking change

Consumers reading *.errors on these return values must read *.diagnostics. React Compiler consumers that read .errors/.warnings separately should use diagnostics.has_errors() / diagnostics.errors() / diagnostics.warnings().

Parser/semantic/isolated-declarations fatality is otherwise unchanged. Builds on the React Compiler transform feature (#23201).

🤖 Generated with Claude Code

@github-actions github-actions Bot added A-linter Area - Linter A-parser Area - Parser A-semantic Area - Semantic A-cli Area - CLI A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler A-codegen Area - Code Generation A-isolated-declarations Isolated Declarations A-ast-tools Area - AST tools A-formatter Area - Formatter A-allocator Area - Allocator labels Jun 10, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd5107f82d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/oxc_parser/src/lib.rs
@codspeed-hq

codspeed-hq Bot commented Jun 10, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 9 skipped benchmarks1


Comparing refactor/diagnostics-type (dcedbc4) with main (2c28748)

Open in CodSpeed

Footnotes

  1. 9 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Boshen Boshen force-pushed the refactor/diagnostics-type branch from bd5107f to ac222c5 Compare June 10, 2026 09:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac222c50b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tasks/coverage/src/driver.rs
Comment thread tasks/transform_conformance/src/driver.rs
@Boshen Boshen force-pushed the refactor/diagnostics-type branch 2 times, most recently from f9a1b7c to dcedbc4 Compare June 10, 2026 10:19
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jun 10, 2026

Boshen commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

Merge activity

…iagnostic> (#23217)

## Summary

Introduces `oxc_diagnostics::Diagnostics` — a `Vec<OxcDiagnostic>` newtype that knows the difference between errors and warnings — and makes it the standard diagnostics return value across oxc.

- **New type**: `Diagnostics` with `has_errors()`, `has_warnings()`, `errors()`, `warnings()`, plus `Vec`-like ergonomics (Deref, `IntoIterator`, `Extend`, `From`/`Into<Vec>`) so most call sites are unchanged.
- **Return types**: `ParserReturn`, `SemanticBuilderReturn`, `IsolatedDeclarationsReturn`, the React Compiler `TransformResult`/`LintResult`, and `TransformerReturn` now expose `diagnostics: Diagnostics` instead of `errors: Vec<OxcDiagnostic>` (the React Compiler's separate `errors`/`warnings` are merged into one severity-tagged list).
- **Behaviour**: a React Compiler **error** now stops the transform (no output), while **warnings** flow through and the transform continues. `compile()` aborts codegen only when `diagnostics.has_errors()` — warnings alone no longer abort (previously any diagnostic did).

## Breaking change

Consumers reading `*.errors` on these return values must read `*.diagnostics`. React Compiler consumers that read `.errors`/`.warnings` separately should use `diagnostics.has_errors()` / `diagnostics.errors()` / `diagnostics.warnings()`.

Parser/semantic/isolated-declarations fatality is otherwise unchanged. Builds on the React Compiler transform feature (#23201).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@graphite-app graphite-app Bot force-pushed the refactor/diagnostics-type branch from dcedbc4 to 777f02a Compare June 10, 2026 14:46
@graphite-app graphite-app Bot merged commit 777f02a into main Jun 10, 2026
31 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jun 10, 2026
@graphite-app graphite-app Bot deleted the refactor/diagnostics-type branch June 10, 2026 14:52
Dunqing pushed a commit to oxc-project/monitor-oxc that referenced this pull request Jun 11, 2026
## Summary
- Update the monitor driver for the `Diagnostics` API introduced by
`oxc-project/oxc#23217`.
camc314 pushed a commit that referenced this pull request Jul 3, 2026
…iagnostic> (#23217)

## Summary

Introduces `oxc_diagnostics::Diagnostics` — a `Vec<OxcDiagnostic>` newtype that knows the difference between errors and warnings — and makes it the standard diagnostics return value across oxc.

- **New type**: `Diagnostics` with `has_errors()`, `has_warnings()`, `errors()`, `warnings()`, plus `Vec`-like ergonomics (Deref, `IntoIterator`, `Extend`, `From`/`Into<Vec>`) so most call sites are unchanged.
- **Return types**: `ParserReturn`, `SemanticBuilderReturn`, `IsolatedDeclarationsReturn`, the React Compiler `TransformResult`/`LintResult`, and `TransformerReturn` now expose `diagnostics: Diagnostics` instead of `errors: Vec<OxcDiagnostic>` (the React Compiler's separate `errors`/`warnings` are merged into one severity-tagged list).
- **Behaviour**: a React Compiler **error** now stops the transform (no output), while **warnings** flow through and the transform continues. `compile()` aborts codegen only when `diagnostics.has_errors()` — warnings alone no longer abort (previously any diagnostic did).

## Breaking change

Consumers reading `*.errors` on these return values must read `*.diagnostics`. React Compiler consumers that read `.errors`/`.warnings` separately should use `diagnostics.has_errors()` / `diagnostics.errors()` / `diagnostics.warnings()`.

Parser/semantic/isolated-declarations fatality is otherwise unchanged. Builds on the React Compiler transform feature (#23201).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocator Area - Allocator A-ast-tools Area - AST tools A-cli Area - CLI A-codegen Area - Code Generation A-formatter Area - Formatter A-isolated-declarations Isolated Declarations A-linter Area - Linter A-minifier Area - Minifier A-parser Area - Parser A-semantic Area - Semantic A-transformer Area - Transformer / Transpiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant