Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler-cli): use inline type-check blocks for components outsid…
…e `rootDir` (#46096) An inline type-check block is required when a reference to a component class cannot be emitted from an ngtypecheck shim file, but the logic to detect this situation did not consider the configured `rootDir`. When a `rootDir` is configured the reference emitter does not allow generating an import outside this directory, which meant that a shim file wouldn't be able to reference the component class. Consequently, type-check block generation would fail with a fatal error that is unaccounted for, as gathering diagnostics should be non-fallible. This commit fixes the problem by leveraging the existing `canReferenceType` logic of the type-checking `Environment`, instead of the rudimentary check whether the class is exported as top-level symbol (`checkIfClassIsExported`). Instead, `canReferenceType` pre-flights the generation of an import using the `ReferenceEmitter` to tell exactly whether it will succeed or not; thus taking into account the `rootDirs` constraint as well. Fixes #44999 PR Close #46096
- Loading branch information
1 parent
71b6b9e
commit f35f475
Showing
4 changed files
with
18 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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