Skip to content

[13.3.x] fix(compiler-cli): handle inline type-check blocks in nullish coalescing extended check#45478

Closed
JoostK wants to merge 3 commits intoangular:13.3.xfrom
JoostK:ngtsc/ttc/shim-locations-v13
Closed

[13.3.x] fix(compiler-cli): handle inline type-check blocks in nullish coalescing extended check#45478
JoostK wants to merge 3 commits intoangular:13.3.xfrom
JoostK:ngtsc/ttc/shim-locations-v13

Conversation

@JoostK
Copy link
Member

@JoostK JoostK commented Mar 30, 2022

Backport of #45454

JoostK added 3 commits March 30, 2022 18:59
Inline type check blocks (TCBs) are emitted into the original source file, but
node positions would still be represented as a `ShimLocation` with a `shimPath`
corresponding with the type-checking shim file. This results in inconsistencies,
as the `positionInShimFile` field of `ShimLocation` would not correspond with
the `shimPath` of that `ShimLocation`.

This commit is a precursor to letting `ShimLocation` also represent the correct
location for inline type check blocks, by renaming the interface to
`TcbLocation`. A followup commit addresses the actual inconsistency.
…h a shim file

Extends `TcbPosition` with a field that indicates whether the `tcbPath` is a
type-checking shim file, or an original source file with an inline type check
block.

This field is used in an upcoming commit that fixes an inconsistency with how
inline type check blocks are incorrectly interpreted as a type-checking shim
file instead.
…ing extended check

This commit fixes an inconsistency where a type check location for an inline
type check block would be interpreted to occur in a type-checking shim instead.
This resulted in a missing template mapping, causing a crash due to an unsafe
non-null assertion operator.

In the prior commit the `TcbLocation` has been extended with an `isShimFile`
field that is now being used to look for the template mapping in the correct
location. Additionally, the non-null assertion operator is refactored such
that a missing template mapping will now ignore the warning instead of crashing
the compiler.

Fixes angular#45413
@JoostK JoostK added target: patch This PR is targeted for the next patch release area: compiler Issues related to `ngc`, Angular's template compiler PullApprove: disable labels Mar 30, 2022
@ngbot ngbot bot modified the milestone: Backlog Mar 30, 2022
@JoostK JoostK added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Mar 30, 2022
@ngbot
Copy link

ngbot bot commented Mar 30, 2022

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "ci/circleci: test_aio_local" is failing
    pending status "google3" is pending
    pending status "pullapprove" is pending

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@JoostK
Copy link
Member Author

JoostK commented Mar 30, 2022

merge-assistance: presubmit not needed since this only targets 13.3 and the size failure is inherited from 13.3.x and addressed independently in #45480.

@JoostK JoostK marked this pull request as ready for review March 30, 2022 18:30
@dylhunn
Copy link
Contributor

dylhunn commented Mar 30, 2022

This PR was merged into the repository by commit 7f53c0f.

@dylhunn dylhunn closed this Mar 30, 2022
dylhunn pushed a commit that referenced this pull request Mar 30, 2022
Inline type check blocks (TCBs) are emitted into the original source file, but
node positions would still be represented as a `ShimLocation` with a `shimPath`
corresponding with the type-checking shim file. This results in inconsistencies,
as the `positionInShimFile` field of `ShimLocation` would not correspond with
the `shimPath` of that `ShimLocation`.

This commit is a precursor to letting `ShimLocation` also represent the correct
location for inline type check blocks, by renaming the interface to
`TcbLocation`. A followup commit addresses the actual inconsistency.

PR Close #45478
dylhunn pushed a commit that referenced this pull request Mar 30, 2022
…h a shim file (#45478)

Extends `TcbPosition` with a field that indicates whether the `tcbPath` is a
type-checking shim file, or an original source file with an inline type check
block.

This field is used in an upcoming commit that fixes an inconsistency with how
inline type check blocks are incorrectly interpreted as a type-checking shim
file instead.

PR Close #45478
dylhunn pushed a commit that referenced this pull request Mar 30, 2022
…ing extended check (#45478)

This commit fixes an inconsistency where a type check location for an inline
type check block would be interpreted to occur in a type-checking shim instead.
This resulted in a missing template mapping, causing a crash due to an unsafe
non-null assertion operator.

In the prior commit the `TcbLocation` has been extended with an `isShimFile`
field that is now being used to look for the template mapping in the correct
location. Additionally, the non-null assertion operator is refactored such
that a missing template mapping will now ignore the warning instead of crashing
the compiler.

Fixes #45413

PR Close #45478
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Mar 31, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@angular/animations](https://github.com/angular/angular) | dependencies | patch | [`13.3.0` -> `13.3.1`](https://renovatebot.com/diffs/npm/@angular%2fanimations/13.3.0/13.3.1) |
| [@angular/common](https://github.com/angular/angular) | dependencies | patch | [`13.3.0` -> `13.3.1`](https://renovatebot.com/diffs/npm/@angular%2fcommon/13.3.0/13.3.1) |
| [@angular/compiler](https://github.com/angular/angular) | dependencies | patch | [`13.3.0` -> `13.3.1`](https://renovatebot.com/diffs/npm/@angular%2fcompiler/13.3.0/13.3.1) |
| [@angular/compiler-cli](https://github.com/angular/angular) | devDependencies | patch | [`13.3.0` -> `13.3.1`](https://renovatebot.com/diffs/npm/@angular%2fcompiler-cli/13.3.0/13.3.1) |
| [@angular/core](https://github.com/angular/angular) | dependencies | patch | [`13.3.0` -> `13.3.1`](https://renovatebot.com/diffs/npm/@angular%2fcore/13.3.0/13.3.1) |
| [@angular/forms](https://github.com/angular/angular) | dependencies | patch | [`13.3.0` -> `13.3.1`](https://renovatebot.com/diffs/npm/@angular%2fforms/13.3.0/13.3.1) |
| [@angular/platform-browser](https://github.com/angular/angular) | dependencies | patch | [`13.3.0` -> `13.3.1`](https://renovatebot.com/diffs/npm/@angular%2fplatform-browser/13.3.0/13.3.1) |
| [@angular/platform-browser-dynamic](https://github.com/angular/angular) | dependencies | patch | [`13.3.0` -> `13.3.1`](https://renovatebot.com/diffs/npm/@angular%2fplatform-browser-dynamic/13.3.0/13.3.1) |

---

### Release Notes

<details>
<summary>angular/angular</summary>

### [`v13.3.1`](https://github.com/angular/angular/blob/HEAD/CHANGELOG.md#&#8203;1331-2022-03-30)

[Compare Source](angular/angular@13.3.0...13.3.1)

##### bazel

| Commit | Type | Description |
| -- | -- | -- |
| [960e42b2ac](angular/angular@960e42b) | fix | ng module compilation workers are subject to linker race-conditions ([#&#8203;45393](angular/angular#45393)) |

##### compiler

| Commit | Type | Description |
| -- | -- | -- |
| [3714305f84](angular/angular@3714305) | fix | scope css rules within `@layer` blocks ([#&#8203;45396](angular/angular#45396)) |

##### compiler-cli

| Commit | Type | Description |
| -- | -- | -- |
| [7f53c0f4ac](angular/angular@7f53c0f) | fix | handle inline type-check blocks in nullish coalescing extended check ([#&#8203;45478](angular/angular#45478)) |

#### Special Thanks

AlirezaEbrahimkhani, Andrew Kushnir, Andrew Scott, Ben Brook, Dylan Hunn, George Kalpakas, JiaLiPassion, Joey Perrott, JoostK, Mike, Paul Gschwendtner, Willian Corrêa, arturovt, dario-piotrowicz, khai and mgechev

<!-- CHANGELOG SPLIT MARKER -->

</details>

---

### Configuration

📅 **Schedule**: 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.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- 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/1277
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>
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note PullApprove: disable target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants