Skip to content

Conversation

ulrichstark
Copy link
Contributor

@ulrichstark ulrichstark commented Oct 3, 2025

The following four cases are now errors in parser instead of semantic errors.
TS Playground for reference.
Closes #14013

abstract class Foo {
  abstract prop = 3;

  abstract method() { }

  abstract get getter() {
    return 1;
  }

  abstract set setter(value: number) {
    
  }
}

@ulrichstark ulrichstark requested a review from Dunqing as a code owner October 3, 2025 17:42
@Copilot Copilot AI review requested due to automatic review settings October 3, 2025 17:42
@github-actions github-actions bot added A-parser Area - Parser A-semantic Area - Semantic labels Oct 3, 2025
Copy link
Contributor

@Copilot 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 validation of abstract class members with implementation from semantic analysis to parser level, providing earlier error detection. The change ensures that abstract properties with initializers, abstract methods with implementations, and abstract accessors with implementations are caught during parsing rather than later semantic validation.

  • Moves abstract member validation logic from semantic checker to parser
  • Removes semantic validation functions and imports for abstract member checking
  • Adds new parser diagnostic functions for abstract member validation errors

Reviewed Changes

Copilot reviewed 4 out of 8 changed files in this pull request and generated no comments.

File Description
crates/oxc_semantic/src/checker/typescript.rs Removes abstract member validation functions and import cleanup
crates/oxc_semantic/src/checker/mod.rs Removes property definition check call
crates/oxc_parser/src/js/class.rs Adds abstract member validation logic in property and method parsing
crates/oxc_parser/src/diagnostics.rs Adds new diagnostic functions for abstract member errors

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

@github-actions github-actions bot added the C-bug Category - Bug label Oct 3, 2025
Copy link

codspeed-hq bot commented Oct 3, 2025

CodSpeed Instrumentation Performance Report

Merging #14325 will not alter performance

Comparing ulrichstark:forbid-abstract-class-members-with-implementation-in-parser-instead-of-semantic (e659c9e) with main (0c14e50)

Summary

✅ 37 untouched

@ulrichstark ulrichstark requested a review from fisker October 4, 2025 10:19
Copy link

@fisker fisker left a comment

Choose a reason for hiding this comment

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

Can't approve since I don't have access, but LGTM.

@Boshen Boshen merged commit 81a28d4 into oxc-project:main Oct 5, 2025
29 checks passed
@ulrichstark ulrichstark deleted the forbid-abstract-class-members-with-implementation-in-parser-instead-of-semantic branch October 5, 2025 07:14
@Boshen Boshen mentioned this pull request Oct 6, 2025
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.

Forbid abstract property to have an initializer in parser instead of semantic
3 participants