Skip to content

fix(import-elision): count an aliased Angular param decorator as removed - #621

Merged
Brooooooklyn merged 1 commit into
mainfrom
fix/inject-alias-elision
Oct 23, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
fix/inject-alias-elision

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Follow-up to #606.

Problem

With advancedOptimizations, #606 removes an @Inject(TOKEN) import only when every value use of TOKEN sits inside a decorator that compilation removes. To decide that, it matched the decorator's local name, so @I(TOKEN) for import { Inject as I } didn't count. The compiler does remove it, and the factory uses i1.TOKEN. A file with both shapes therefore kept an import that nothing uses:

import { Inject as I } from "@angular/core";
import { TOKEN } from "./tokens";   // kept, but never used in the output
@Injectable() export class A { constructor(@I(TOKEN) v: unknown) {} }
@Injectable() export class B { constructor(@Inject(TOKEN) v: unknown) {} }

Main removed it; #606 kept it.

Fix

Decide by what the decorator resolves to (angular_param_decorator, which follows aliases and ng.Inject), not by its local name.

Checks

  • New test test_aliased_inject_counts_as_removed. cargo test --workspace: 3415 passed.
  • The output for the case above imports i1 from ./tokens and no named TOKEN, like main.

🤖 Generated with Claude Code

`@I(TOKEN)` for `import { Inject as I }` is removed like `@Inject(TOKEN)`,
but the removed-reference set matched the local name, so a file with both
kept an unused TOKEN import.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Brooooooklyn

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T10:24:25.610389Z ed0bde2 Manual request
ℹ️ 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: ed0bde2ef5

ℹ️ 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".

@Brooooooklyn
Brooooooklyn merged commit 04cb3b2 into main Oct 23, 2026
10 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/inject-alias-elision branch October 23, 2026 12:16
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.

1 participant