Skip to content

fix(compiler): keep spread arguments in call/new expressions and list foreign-decorated members in propDecorators - #556

Merged
Brooooooklyn merged 2 commits into
mainfrom
fix/issue-511-spread-args
Oct 7, 2026
Merged

Brooooooklyn merged 2 commits into
mainfrom
fix/issue-511-spread-args

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Summary

Fixes #511 — two byte-parity divergences from ngtsc in setClassMetadata / decorator metadata emit:

  1. Spread arguments were flattened. Argument::SpreadElement in call and new expressions converted the inner expression but dropped the ..., so f(...P) emitted as f(P) and new Box(...P) as new Box(P). Both convert_call_expression_with_optional and convert_new_expression now wrap the argument in OutputExpression::SpreadElement, which the emitter already prints as ...expr.

  2. propDecorators skipped members whose decorators aren't Angular's. ngtsc lists any member with member.decorators.length > 0 (metadata.ts:107); decoratedClassMemberToMetadata filters the array to Angular decorators, so a member carrying only foreign/local decorators emits prop: []. We gated the whole entry on !angular_decorators.is_empty() and emitted nothing. Now gated on !decorators.is_empty(). This also fixes decorated signal-initializer members (@Foo() x = input(...)) — upstream's decorated branch wins, so they emit x: [], not the initializer-API entry.

Ground truth verified by compiling repros with real ngtsc (@angular/compiler-cli 22.x): emits { x: [], y: [{type: Input}] } and { c: [], d: [], b: [{type: core.Output}] }.

Changes

  • src/output/oxc_converter.rs: preserve SpreadElement in call/new args (issue comment references).
  • src/class_metadata/builders.rs: propDecorators entry unconditional on the member having decorators.
  • New tests/spread_metadata_emit_test.rs (5 tests): spread preserved in full + partial mode for call and new; x: [] for foreign-decorated and decorated-signal members.
  • Updated stale assertions in decorator_metadata_ngtsc_test.rs (c:[],d:[]) and integration_test.rs (foreignMember:[] + insta snapshot) to the ngc-verified shape.

Verification

  • cargo test --all-features: all pass
  • cargo check, cargo check --all-features, cargo fmt --all -- --check: clean
  • cargo run -p oxc_angular_conformance: 1264/1264

Issue #511: two divergences from ngtsc emit.

- `Argument::SpreadElement` in call/new expressions dropped the `...`,
  emitting `f(P)` for `f(...P)`. Both converters now emit
  `OutputExpression::SpreadElement`.
- `propDecorators` skipped members with only non-Angular decorators;
  ngtsc lists them as `prop: []` (metadata.ts:107 gates on
  `member.decorators.length > 0`, decorators are filtered afterward).
  Verified against real ngtsc 22 ngc output.

Fixes #511
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T07:56:22.636966Z 1bbca3b New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 04a8eb1cda

ℹ️ 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_angular_compiler/src/class_metadata/builders.rs Outdated
Review round: `@a.b.Foo()` / `@(a.Foo)()` callees don't survive ngtsc's
`_reflectDecorator` (`isDecoratorIdentifier` requires an identifier or
`ns.Name` access), so `member.decorators` is null upstream and the member
takes the `undecoratedMetadataExtractor` path. Gate on reflected
decorators instead of raw decorator nodes so `input()` members decorated
that way still get the synthesized `Input` entry.
@Brooooooklyn
Brooooooklyn merged commit a092362 into main Oct 7, 2026
10 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/issue-511-spread-args branch October 7, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(emit): spread arguments in calls and new are dropped (f(...P) → f(P))

1 participant