Skip to content

[Patch port] fix(compiler-cli): don't type check the bodies of control flow nodes in basic mode#55558

Closed
crisbeto wants to merge 1 commit intoangular:17.3.xfrom
crisbeto:17.3.x-type-check
Closed

[Patch port] fix(compiler-cli): don't type check the bodies of control flow nodes in basic mode#55558
crisbeto wants to merge 1 commit intoangular:17.3.xfrom
crisbeto:17.3.x-type-check

Conversation

@crisbeto
Copy link
Member

This is a port of #55360 to the patch release. I had to adjust some of the code and the tests since the TCB shape changed in v18, but the underlying logic is the same.

Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax.

These changes mimic the old behavior by not checking the bodies of if, switch and for blocks in basic mode. Note that the expressions of the blocks are still going to be checked.

Fixes #52969.

…in basic mode

Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax.

These changes mimic the old behavior by not checking the bodies of `if`, `switch` and `for` blocks in basic mode. Note that the expressions of the blocks are still going to be checked.

Fixes angular#52969.
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release area: compiler Issues related to `ngc`, Angular's template compiler labels Apr 26, 2024
@ngbot ngbot bot added this to the Backlog milestone Apr 26, 2024
@pkozlowski-opensource pkozlowski-opensource added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Apr 26, 2024
@crisbeto crisbeto added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Apr 26, 2024
@crisbeto
Copy link
Member Author

Caretaker note: this is ready to go. The mergability check is taking a long time to run for some reason.

@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit 51ac883.

AndrewKushnir pushed a commit that referenced this pull request Apr 26, 2024
…in basic mode (#55558)

Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax.

These changes mimic the old behavior by not checking the bodies of `if`, `switch` and `for` blocks in basic mode. Note that the expressions of the blocks are still going to be checked.

Fixes #52969.

PR Close #55558
@fidlip
Copy link

fidlip commented May 16, 2024

Hi, thanks for this PR. Is there some plan to manage "checkControlFlowBodies" flag state from configuration in future?

@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 Jun 16, 2024
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 target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants