Skip to content

fix(partial): handle FactoryTarget::Service in partial factory emit#329

Merged
brandonroberts merged 1 commit into
mainfrom
fix/partial-factory-service-target
Jun 1, 2026
Merged

fix(partial): handle FactoryTarget::Service in partial factory emit#329
brandonroberts merged 1 commit into
mainfrom
fix/partial-factory-service-target

Conversation

@brandonroberts
Copy link
Copy Markdown
Collaborator

Summary

Fixes a build break on main after #324 (@Service decorator AOT) and #325 (partial-declaration emit) landed sequentially.

#324 added a new FactoryTarget::Service enum variant. #325 added the partial factory emitter with an exhaustive match on FactoryTarget. Each PR passed CI on its own branch, but the new variant wasn't added to the match in the partial emitter — so cargo build on main now fails:

error[E0004]: non-exhaustive patterns: `FactoryTarget::Service` not covered
  --> crates/oxc_angular_compiler/src/partial/factory.rs:173:25

Fix

Group Service with Injectable in the partial-emit match. At runtime, Service factories use the same ɵɵinject token path as Injectable — factory/compiler.rs:664 already groups them in the full-mode dispatch — so the partial declaration's target: i0.ɵɵFactoryTarget.Injectable produces the correct linked factory.

- FactoryTarget::Injectable => "Injectable",
+ FactoryTarget::Injectable | FactoryTarget::Service => "Injectable",

Test plan

  • cargo build -p oxc_angular_compiler — clean
  • cargo test -p oxc_angular_compiler2689 passed, 0 failed
  • pnpm build (full native + tsc) — clean
  • When @Service AOT gains its own partial-emit slice with a proper ɵɵngDeclareService shape, swap the match arm to a dedicated "Service" variant and add a FactoryTarget::Service test fixture.

🤖 Generated with Claude Code

Building main fails after #324 (@service) and #325 (partial mode) landed
sequentially:

  error[E0004]: non-exhaustive patterns: `FactoryTarget::Service` not covered
    --> crates/oxc_angular_compiler/src/partial/factory.rs:173:25

#324 added the new variant; #325 added the partial factory emitter. Each
branch passed CI independently, but the variant was missing from the
match in partial mode's `factory_target_expr`.

Group Service with Injectable in the partial-emit match arm. At runtime
Service factories use the same `ɵɵinject` token path as Injectable —
see `factory/compiler.rs:664` where they're already grouped in the
full-mode dispatch — so the partial declaration's
`target: i0.ɵɵFactoryTarget.Injectable` produces the correct linked
factory.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@brandonroberts brandonroberts enabled auto-merge (squash) June 1, 2026 02:17
@brandonroberts brandonroberts merged commit 269551b into main Jun 1, 2026
9 checks passed
@brandonroberts brandonroberts deleted the fix/partial-factory-service-target branch June 1, 2026 03:26
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.

2 participants