fix(compiler-cli): Produce correct tcb expression for optional chaining - #70232
Open
JeanMeche wants to merge 2 commits into
Open
fix(compiler-cli): Produce correct tcb expression for optional chaining#70232JeanMeche wants to merge 2 commits into
JeanMeche wants to merge 2 commits into
Conversation
The semantics of optional chaining changes when there are extra parenthesis. We need to make sure that we do not introduce some unnecessary ones. fixes angular#70143
JoostK
reviewed
Aug 18, 2026
JoostK
left a comment
Member
There was a problem hiding this comment.
Ideally this can also be tested from ngtsc's template type checking tests that capture real diagnostics for test components, instead of only asserting against the generated TCB; parenthesis wrapping is subtle enough that any TCB changes are likely to just be accepted without seeing the effect it has on type-checking behaviour.
Member
Author
|
I've added a test, although this issue can already really be caught by the extended diagnostic. Regular TS doesn't mind about unecessary optional chaining. |
PowerKiKi
reviewed
Aug 18, 2026
JeanMeche
force-pushed
the
tcb-optional-chaining-fix2
branch
from
August 18, 2026 13:23
d185f2c to
746355a
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The semantics of optional chaining changes when there are extra parenthesis. We need to make sure that we do not introduce some unnecessary ones.
fixes #70143