Skip to content

fix(compiler): exclude more safe reads expression from 2way-binding #62852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

JeanMeche
Copy link
Member

Priori to this fix the parser would allow safereads in accestor receievers (but the direct one).

fixes #62837

@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Jul 28, 2025
@ngbot ngbot bot added this to the Backlog milestone Jul 28, 2025
@JeanMeche JeanMeche force-pushed the compiler/fix-safe-read-2way branch from 3b62a2c to 10b10db Compare July 28, 2025 11:09
@JeanMeche JeanMeche requested a review from crisbeto July 28, 2025 12:27
@JeanMeche JeanMeche marked this pull request as ready for review July 28, 2025 12:27
@JeanMeche
Copy link
Member Author

This change will require a G3 cleanup, it raised valid errors.

Copy link
Member

@JoostK JoostK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's have tests for these:

(foo?.bar).baz // not null-safe and would crash at runtime, but may not report an error without `strictNullChecks`

(foo?.bar ?? bar).baz // This is safe and should be allowed

@JeanMeche JeanMeche force-pushed the compiler/fix-safe-read-2way branch from 10b10db to 38fb1a9 Compare July 28, 2025 12:57
@JeanMeche
Copy link
Member Author

JeanMeche commented Jul 28, 2025

@JoostK, good point. Your 1st example will won't throw with the implementation currently in PR. Will look to support it.

Priori to this fix the parser would allow safereads in accestor receievers (but the direct one).

fixes angular#62837
@JeanMeche
Copy link
Member Author

TGP is "green"

@JeanMeche JeanMeche removed the request for review from crisbeto July 29, 2025 17:21
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Jul 29, 2025
thePunderWoman pushed a commit that referenced this pull request Jul 29, 2025
…62852)

Priori to this fix the parser would allow safereads in accestor receievers (but the direct one).

fixes #62837

PR Close #62852
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository by commit 5b25d93.

The changes were merged into the following branches: main, 20.1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SyntaxError: Invalid left-hand side in assignment in Karma tests after updating from 20.0.5 to 20.1.3
3 participants