Skip to content

Conversation

@ulrichstark
Copy link
Contributor

@ulrichstark ulrichstark commented Sep 18, 2025

Closes #13883

This also fixes duplicate essentially same diagnostics coming from parser and semantic each.

Copilot AI review requested due to automatic review settings September 18, 2025 21:00
@github-actions github-actions bot added A-parser Area - Parser A-semantic Area - Semantic C-bug Category - Bug labels Sep 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR moves the validation logic for readonly parameter properties from the semantic checker to the parser, preventing readonly modifiers from being parsed outside of constructor contexts rather than detecting them later during semantic analysis.

  • Removes semantic validation of parameter properties outside constructors
  • Updates parser to only allow readonly modifiers in constructor parameters
  • Simplifies parameter validation logic by consolidating conditions

Reviewed Changes

Copilot reviewed 2 out of 5 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_semantic/src/checker/typescript.rs Removes parameter property validation and streamlines optional parameter checking
crates/oxc_parser/src/js/function.rs Updates modifier validation to restrict readonly to constructor contexts only

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 18, 2025

CodSpeed Instrumentation Performance Report

Merging #13905 will not alter performance

Comparing ulrichstark:forbid-readonly-in-parser-instead-of-semantic (d376144) with main (91c88e2)1

Summary

✅ 37 untouched

Footnotes

  1. No successful run was found on main (7d45b2f) during the generation of this report, so 91c88e2 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@ulrichstark ulrichstark force-pushed the forbid-readonly-in-parser-instead-of-semantic branch from defd00e to d376144 Compare September 18, 2025 21:42
@Boshen
Copy link
Member

Boshen commented Sep 19, 2025

Very nice, thank you!

@Boshen Boshen merged commit f067159 into oxc-project:main Sep 19, 2025
51 of 53 checks passed
@ulrichstark ulrichstark deleted the forbid-readonly-in-parser-instead-of-semantic branch September 19, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser A-semantic Area - Semantic C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parser: forbid readonly in parser instead of semantic

2 participants