Repository navigation
fix(partial): keep pipe ctor deps and inherited factories in ɵɵngDeclareFactory - #656
Merged
Merged
Conversation
…areFactory Partial-mode factories lost constructor information, which broke code silently after linking: - A @pipe always got `deps: []`, so its constructor deps were dropped. `PipeMetadata::to_r3_metadata` now passes the extracted deps through (with the type-only flag), like ngtsc's `PipeDecoratorHandler`, which calls `compileDeclareFactory(toFactoryMetadata(analysis.meta, FactoryTarget.Pipe))` with the analyzed ctor deps (compiler-cli/src/ngtsc/annotations/src/pipe.ts). - A @pipe, @Injectable or @NgModule with no constructor that extends a base class got `deps: []` instead of `deps: null`. `null` is what `getConstructorDependencies` returns for such a class (compiler-cli/src/ngtsc/annotations/common/src/di.ts), and `compileDependencies` (compiler/src/render3/partial/util.ts) emits it as-is so the linker uses `ɵɵgetInheritedFactory`. Directives and components already did this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Found while re-checking #623.
Fixes two partial-mode (
compilationMode: 'partial') factory bugs. Both broke code silently after linking.PipeMetadata::to_r3_metadatahard-codeddeps: None, and the partial pipe factory turnedNoneintodeps: []. It now passes the extracted deps through, including the type-only flag. To carry that flag,pipe::R3DependencyMetadatagets atype_only_invalidfield. Full mode was already right.deps: []instead ofdeps: null. This was true for @pipe, @Injectable and @NgModule. NowNone(no constructor, but a base class) emitsdeps: null, and the linker turns that intoɵɵgetInheritedFactory. Directives and components were already right.Ported from:
PipeDecoratorHandler.compilePartial→compileDeclareFactory(toFactoryMetadata(analysis.meta, FactoryTarget.Pipe))(compiler-cliannotations/src/pipe.ts)getConstructorDependenciesreturnsnullfor "no ctor + base class" (compiler-cliannotations/common/src/di.ts)compileDependenciesemitsnullas-is (compilerrender3/partial/util.ts)Before / after
ngtsc parity cases checked (partial mode, ngtsc 22.2.3)
Every
ɵfacmatches ngtsc. Only the version string differs.(o: Ok)deps:[{token:Ok}]@Inject(TOK)+@Optional()deps:[{token:TOK},{token:Ok,optional:true}]deps:[]deps:null@Injectable()andprovidedIn:'root')deps:nulldeps:[]deps:null(was already right)deps:null(was already right)deps:null(was[])deps:[]I also linked our partial output with
linkAngularPackageSync. The pipe factories injectOk/TOKwith the right flags (16 / 24). Every inheriting class links toɵɵgetInheritedFactory(X).Checks
tests/partial_e2e_test.rs(4 tests: transform in partial mode, then link). All 4 fail withsrcstashed and pass with the fix.cargo test --all-features: 3603 passed, 0 failedcargo clippy --all-features --all-targets: no new warnings on changed linesbuild-test,vitest run --dir ./test: 397/397 passed.tsc --noEmitis clean.known-differences.tsis unchanged because the e2e compare runs in full mode only.🤖 Generated with Claude Code