fix(compiler-cli): use inline type-check blocks for components outside rootDir#46096
Closed
JoostK wants to merge 1 commit intoangular:mainfrom
Closed
fix(compiler-cli): use inline type-check blocks for components outside rootDir#46096JoostK wants to merge 1 commit intoangular:mainfrom
rootDir#46096JoostK wants to merge 1 commit intoangular:mainfrom
Conversation
…e `rootDir` 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 angular#44999
alxhub
approved these changes
Jun 10, 2022
Contributor
|
This PR was merged into the repository by commit f35f475. |
jessicajaniuk
pushed a commit
that referenced
this pull request
Jun 10, 2022
…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
crapStone
pushed a commit
to Calciumdibromid/CaBr2
that referenced
this pull request
Jun 17, 2022
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@angular/animations](https://github.com/angular/angular) | dependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fanimations/14.0.1/14.0.2) | | [@angular/common](https://github.com/angular/angular) | dependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fcommon/14.0.1/14.0.2) | | [@angular/compiler](https://github.com/angular/angular) | dependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fcompiler/14.0.1/14.0.2) | | [@angular/compiler-cli](https://github.com/angular/angular) | devDependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fcompiler-cli/14.0.1/14.0.2) | | [@angular/core](https://github.com/angular/angular) | dependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fcore/14.0.1/14.0.2) | | [@angular/forms](https://github.com/angular/angular) | dependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fforms/14.0.1/14.0.2) | | [@angular/platform-browser](https://github.com/angular/angular) | dependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fplatform-browser/14.0.1/14.0.2) | | [@angular/platform-browser-dynamic](https://github.com/angular/angular) | dependencies | patch | [`14.0.1` -> `14.0.2`](https://renovatebot.com/diffs/npm/@angular%2fplatform-browser-dynamic/14.0.1/14.0.2) | | [zone.js](https://github.com/angular/angular) ([changelog](https://github.com/angular/angular/blob/master/packages/zone.js/CHANGELOG.md)) | dependencies | patch | [`0.11.5` -> `0.11.6`](https://renovatebot.com/diffs/npm/zone.js/0.11.5/0.11.6) | --- ### Release Notes <details> <summary>angular/angular (@​angular/animations)</summary> ### [`v14.0.2`](https://github.com/angular/angular/blob/HEAD/CHANGELOG.md#​1402-2022-06-15) [Compare Source](angular/angular@14.0.1...14.0.2) ##### common | Commit | Type | Description | | -- | -- | -- | | [ef5cba3df7](angular/angular@ef5cba3) | fix | allow null in ngComponentOutlet ([#​46280](angular/angular#46280)) | ##### compiler-cli | Commit | Type | Description | | -- | -- | -- | | [8ecfd71fd7](angular/angular@8ecfd71) | fix | don't emit empty providers array ([#​46301](angular/angular#46301)) | | [b92c1a6ada](angular/angular@b92c1a6) | fix | use inline type-check blocks for components outside `rootDir` ([#​46096](angular/angular#46096)) | ##### core | Commit | Type | Description | | -- | -- | -- | | [3fd8948b4a](angular/angular@3fd8948) | fix | Resolve forwardRef declarations for jit ([#​46334](angular/angular#46334)) | #### Special Thanks Alex Rickabaugh, Andrew Scott, Badawi7, Daniel Schmitz, Derek Cormier, JoostK, Kevin Davila, Kristiyan Kostadinov, Paul Draper, Paul Gschwendtner, Tom Eustace, Totati, Younes Jaaidi, alefra, dario-piotrowicz, markostanimirovic, mgechev, piyush132000, sten-bone and vivekkoya <!-- CHANGELOG SPLIT MARKER --> </details> <details> <summary>angular/angular (zone.js)</summary> ### [`v0.11.6`](https://github.com/angular/angular/blob/HEAD/packages/zone.js/CHANGELOG.md#​0116-httpsgithubcomangularangularcomparezonejs-0115zonejs-0116-2022-06-02) [Compare Source](angular/angular@zone.js-0.11.5...zone.js-0.11.6) ##### Bug Fixes - **zone.js:** check if `process` is defined when patching the `GlobalErrors.install` ([#​45392](angular/angular#45392)) ([c7bcc1b](angular/angular@c7bcc1b)), closes [#​42260](angular/angular#42260) - **zone.js:** in TaskTrackingZoneSpec track a periodic task until it is cancelled ([#​45391](angular/angular#45391)) ([f19b36f](angular/angular@f19b36f)) - **zone.js:** read `Symbol.species` safely ([#​45369](angular/angular#45369)) ([e2eaac3](angular/angular@e2eaac3)) - **zone.js:** should ignore multiple resolve call ([#​45283](angular/angular#45283)) ([aebf165](angular/angular@aebf165)), closes [#​44913](angular/angular#44913) - **zone.js:** swallow the error when the element callback is not patchable ([#​45400](angular/angular#45400)) ([4ea70e3](angular/angular@4ea70e3)), closes [lwc/engine-core/src/framework/base-bridge-element.ts#L180-L186](https://github.com/lwc/engine-core/src/framework/base-bridge-element.ts/issues/L180-L186) [#​42546](angular/angular#42546) ##### BREAKING CHANGES - **zone.js:** in TaskTrackingZoneSpec track a periodic task until it is cancelled The breaking change is scoped only to the plugin `zone.js/plugins/task-tracking`. If you used `TaskTrackingZoneSpec` and checked the pending macroTasks e.g. using `(this.ngZone as any)._inner ._parent._properties.TaskTrackingZone.getTasksFor('macroTask')`, then its behavior slightly changed for periodic macrotasks. For example, previously the `setInterval` macrotask was no longer tracked after its callback was executed for the first time. Now it's tracked until the task is explicitly cancelled, e.g with `clearInterval(id)`. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1420 Reviewed-by: 6543 <6543@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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 arootDirisconfigured 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
canReferenceTypelogic of the type-checking
Environment, instead of the rudimentary checkwhether the class is exported as top-level symbol (
checkIfClassIsExported).Instead,
canReferenceTypepre-flights the generation of an import using theReferenceEmitterto tell exactly whether it will succeed or not; thus takinginto account the
rootDirsconstraint as well.Fixes #44999