Skip to content

fix(compiler-cli): emit NG1003 and NG1002 for bare @Pipe and invalid @NgModule calls - #71439

Merged
crisbeto merged 1 commit into
angular:mainfrom
mattrbeck:fix/ngp-bare-pipe-ngmodule-diagnostics
Oct 20, 2026
Merged

crisbeto merged 1 commit into
angular:mainfrom
mattrbeck:fix/ngp-bare-pipe-ngmodule-diagnostics

Conversation

@mattrbeck

@mattrbeck mattrbeck commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #71427.

Checks is_angular_decorator_named before requiring Expression::CallExpression in pipe::parse_decorator and ngmodule::parse_decorator, returning default metadata on malformed calls so parse_class retains the class and surfaces the NG1003 and NG1002 diagnostics produced by class_decorator_argument_issue.

Without this change, test_directive_metadata_shape_diagnostics fails on the three new cases (/project/pipe-bare.ts, /project/ng-module-bare.ts, and /project/ng-module-arity.ts) because pipe::parse_decorator and ngmodule::parse_decorator return None, leaving ng_decorator_spans empty so parse_class returns None and emits [] (no diagnostics) instead of NG1003 (@Pipe must be called) and NG1002 (Incorrect number of arguments to @NgModule decorator).

@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Oct 19, 2026
@ngbot ngbot Bot added this to the Backlog milestone Oct 19, 2026
…NgModule calls

Recognize bare @pipe and @NgModule decorators as well as @NgModule calls with too many arguments in pipe::parse_decorator and ngmodule::parse_decorator so parse_class retains the class and surfaces the NG1003 and NG1002 diagnostics from class_decorator_argument_issue.
@mattrbeck
mattrbeck force-pushed the fix/ngp-bare-pipe-ngmodule-diagnostics branch from fd58204 to a97a04e Compare October 19, 2026 22:57
@mattrbeck
mattrbeck requested a review from crisbeto October 20, 2026 01:04
@mattrbeck
mattrbeck marked this pull request as ready for review October 20, 2026 01:04
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release labels Oct 20, 2026
@crisbeto
crisbeto merged commit fdb84e2 into angular:main Oct 20, 2026
26 of 28 checks passed
@crisbeto

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants