Skip to content

Comments

feat(parser): improve error message for missing function body#15726

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-16-feat_parser_improve_error_for_missing_function_body
Nov 16, 2025
Merged

feat(parser): improve error message for missing function body#15726
graphite-app[bot] merged 1 commit intomainfrom
11-16-feat_parser_improve_error_for_missing_function_body

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Nov 15, 2025

Improved the error message for missing function bodies.

Before

  x Unexpected token
   ,-[:1:15]
 1 | function foo();
   :               ^
   `----

After

  × Expected function body
   ╭─[typescript/tests/cases/compiler/jsFileCompilationFunctionOverloadSyntax.ts:1:1]
 1 │ function foo();
   · ──────────────
   ╰────
  help: Add a function body (`{}`).

@github-actions github-actions bot added A-parser Area - Parser C-enhancement Category - New feature or request labels Nov 15, 2025
Copy link
Member Author

sapphi-red commented Nov 15, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 15, 2025

CodSpeed Performance Report

Merging #15726 will not alter performance

Comparing 11-16-feat_parser_improve_error_for_missing_function_body (b1d3262) with 11-16-feat_parser_improve_error_when_encountering_jsx_when_not_enabled (62a83f5)

Summary

✅ 37 untouched

@sapphi-red sapphi-red requested a review from Boshen November 15, 2025 16:21
@sapphi-red sapphi-red force-pushed the 11-16-feat_parser_improve_error_for_missing_function_body branch from efd41bc to b1d3262 Compare November 15, 2025 16:24
@sapphi-red sapphi-red marked this pull request as ready for review November 15, 2025 16:24
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Nov 16, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 16, 2025

Merge activity

Improved the error message for missing function bodies.

**Before**
```
  x Unexpected token
   ,-[:1:15]
 1 | function foo();
   :               ^
   `----
```

**After**
```
  × Expected function body
   ╭─[typescript/tests/cases/compiler/jsFileCompilationFunctionOverloadSyntax.ts:1:1]
 1 │ function foo();
   · ──────────────
   ╰────
  help: Add a function body (`{}`).
```
@graphite-app graphite-app bot force-pushed the 11-16-feat_parser_improve_error_when_encountering_jsx_when_not_enabled branch from 62a83f5 to 71c2fb0 Compare November 16, 2025 02:57
@graphite-app graphite-app bot force-pushed the 11-16-feat_parser_improve_error_for_missing_function_body branch from b1d3262 to b7404bc Compare November 16, 2025 02:58
Base automatically changed from 11-16-feat_parser_improve_error_when_encountering_jsx_when_not_enabled to main November 16, 2025 03:03
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 16, 2025
@graphite-app graphite-app bot merged commit b7404bc into main Nov 16, 2025
22 checks passed
@graphite-app graphite-app bot deleted the 11-16-feat_parser_improve_error_for_missing_function_body branch November 16, 2025 03:04
graphite-app bot pushed a commit that referenced this pull request Nov 17, 2025
### 💥 BREAKING CHANGES

- ea51b0b napi: [**BREAKING**] Standardize function naming with sync suffixes (#15661) (Boshen)

### 🚀 Features

- 77efb76 parser: Improve error message for invalid switch clauses (#15728) (sapphi-red)
- 5691727 parser: Improve `import source` `from` error message (#15727) (sapphi-red)
- b7404bc parser: Improve error message for missing function body (#15726) (sapphi-red)
- 71c2fb0 parser: Improve error message when JSX is found while not enabled (#15725) (sapphi-red)
- 56e7e44 minifier: Disable removal of unnecessary `use strict` directives for DCE (#15691) (sapphi-red)
- 8a61cfd allocator, ast: Introduce `UnstableAddress` trait (#15700) (overlookmotel)
- f5ce55a napi: Export all options using wildcard exports (Boshen)
- 68703b9 minifier: Rotate binary expressions to remove parentheses (#15473) (sapphi-red)

### 🐛 Bug Fixes

- c023ba6 semantic: Do not duplicate statements in temp `Vec` when binding `TSModuleDeclaration`s (#15724) (overlookmotel)
- d60ca81 parser: Reject `import something 'source'` (#15746) (sapphi-red)
- e0728fa ast: Exclude comment end position from `is_inside_comment` check (#15753) (camc314)
- 9f54a36 semantic: Error on `\00` in strict mode (#15743) (sapphi-red)
- 440a977 ast: Include rest properties when using `get_binding_identifiers` (#15710) (camc314)

### ⚡ Performance

- 1f09d3c parser: Faster checking for invalid modifiers (#15717) (overlookmotel)
- d8d4e31 ast: Use loop instead of recursion in `TSModuleDeclarationBody::as_module_block_mut` (#15713) (overlookmotel)

### 📚 Documentation

- e033d50 ast: Clarify behavior of `TSModuleDeclaration::has_use_strict_directive` (#15730) (overlookmotel)
- 9eda70f allocator: Improve docs for `Address` methods (#15697) (overlookmotel)
overlookmotel pushed a commit that referenced this pull request Nov 17, 2025
### 💥 BREAKING CHANGES

- ea51b0b napi: [**BREAKING**] Standardize function naming with sync
suffixes (#15661) (Boshen)

### 🚀 Features

- 77efb76 parser: Improve error message for invalid switch clauses
(#15728) (sapphi-red)
- 5691727 parser: Improve `import source` `from` error message (#15727)
(sapphi-red)
- b7404bc parser: Improve error message for missing function body
(#15726) (sapphi-red)
- 71c2fb0 parser: Improve error message when JSX is found while not
enabled (#15725) (sapphi-red)
- 56e7e44 minifier: Disable removal of unnecessary `use strict`
directives for DCE (#15691) (sapphi-red)
- 8a61cfd allocator, ast: Introduce `UnstableAddress` trait (#15700)
(overlookmotel)
- f5ce55a napi: Export all options using wildcard exports (Boshen)
- 68703b9 minifier: Rotate binary expressions to remove parentheses
(#15473) (sapphi-red)

### 🐛 Bug Fixes

- c023ba6 semantic: Do not duplicate statements in temp `Vec` when
binding `TSModuleDeclaration`s (#15724) (overlookmotel)
- d60ca81 parser: Reject `import something 'source'` (#15746)
(sapphi-red)
- e0728fa ast: Exclude comment end position from `is_inside_comment`
check (#15753) (camc314)
- 9f54a36 semantic: Error on `\00` in strict mode (#15743) (sapphi-red)
- 440a977 ast: Include rest properties when using
`get_binding_identifiers` (#15710) (camc314)

### ⚡ Performance

- 1f09d3c parser: Faster checking for invalid modifiers (#15717)
(overlookmotel)
- d8d4e31 ast: Use loop instead of recursion in
`TSModuleDeclarationBody::as_module_block_mut` (#15713) (overlookmotel)

### 📚 Documentation

- e033d50 ast: Clarify behavior of
`TSModuleDeclaration::has_use_strict_directive` (#15730) (overlookmotel)
- 9eda70f allocator: Improve docs for `Address` methods (#15697)
(overlookmotel)
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…oject#15726)

Improved the error message for missing function bodies.

**Before**
```
  x Unexpected token
   ,-[:1:15]
 1 | function foo();
   :               ^
   `----
```

**After**
```
  × Expected function body
   ╭─[typescript/tests/cases/compiler/jsFileCompilationFunctionOverloadSyntax.ts:1:1]
 1 │ function foo();
   · ──────────────
   ╰────
  help: Add a function body (`{}`).
```
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
### 💥 BREAKING CHANGES

- ea51b0b napi: [**BREAKING**] Standardize function naming with sync
suffixes (oxc-project#15661) (Boshen)

### 🚀 Features

- 77efb76 parser: Improve error message for invalid switch clauses
(oxc-project#15728) (sapphi-red)
- 5691727 parser: Improve `import source` `from` error message (oxc-project#15727)
(sapphi-red)
- b7404bc parser: Improve error message for missing function body
(oxc-project#15726) (sapphi-red)
- 71c2fb0 parser: Improve error message when JSX is found while not
enabled (oxc-project#15725) (sapphi-red)
- 56e7e44 minifier: Disable removal of unnecessary `use strict`
directives for DCE (oxc-project#15691) (sapphi-red)
- 8a61cfd allocator, ast: Introduce `UnstableAddress` trait (oxc-project#15700)
(overlookmotel)
- f5ce55a napi: Export all options using wildcard exports (Boshen)
- 68703b9 minifier: Rotate binary expressions to remove parentheses
(oxc-project#15473) (sapphi-red)

### 🐛 Bug Fixes

- c023ba6 semantic: Do not duplicate statements in temp `Vec` when
binding `TSModuleDeclaration`s (oxc-project#15724) (overlookmotel)
- d60ca81 parser: Reject `import something 'source'` (oxc-project#15746)
(sapphi-red)
- e0728fa ast: Exclude comment end position from `is_inside_comment`
check (oxc-project#15753) (camc314)
- 9f54a36 semantic: Error on `\00` in strict mode (oxc-project#15743) (sapphi-red)
- 440a977 ast: Include rest properties when using
`get_binding_identifiers` (oxc-project#15710) (camc314)

### ⚡ Performance

- 1f09d3c parser: Faster checking for invalid modifiers (oxc-project#15717)
(overlookmotel)
- d8d4e31 ast: Use loop instead of recursion in
`TSModuleDeclarationBody::as_module_block_mut` (oxc-project#15713) (overlookmotel)

### 📚 Documentation

- e033d50 ast: Clarify behavior of
`TSModuleDeclaration::has_use_strict_directive` (oxc-project#15730) (overlookmotel)
- 9eda70f allocator: Improve docs for `Address` methods (oxc-project#15697)
(overlookmotel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants