-
Notifications
You must be signed in to change notification settings - Fork 26.2k
fix(compiler): this.a
should always refer to class property a
#55183
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
Conversation
I am running a TGP to determine whether any breakages in g3 exist. |
c866bdd
to
a4a0494
Compare
...es/compiler-cli/test/compliance/test_cases/r3_view_compiler_template/ng_template_implicit.js
Outdated
Show resolved
Hide resolved
I just stumbled across angular/packages/compiler/src/render3/view/t2_binder.ts Lines 721 to 726 in f3b6245
in the binder which also seems like it inhibits the broken behavior. |
On that note, should we also update the TCB here? https://github.com/angular/angular/blob/main/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.ts#L2289 |
That one was cross referenced from the template pipeline comment so it's already been updated in this PR. |
Status update: this has a failing TGP (link). It mostly seems to be people referring to template local variables with I will start sending fix CLs. They are very simple fixes, but there are quite a lot of breakage sites. Also removing from v18, since we need some time to send and land all the g3 fixes. |
49dbfc0
to
e053cd7
Compare
Consider a template with a context variable `a`: ``` <ng-template let-a>{{this.a}}</ng-template> ``` t push -fAn interpolation inside that template to `this.a` should intuitively read the class variable `a`. However, today, it refers to the context variable `a`, both in the TCB and the generated code. In this commit, the above interpolation now refers to the class field `a`. BREAKING CHANGE: `this.foo` property reads no longer refer to template context variables. If you intended to read the template variable, do not use `this.`. Fixes angular#55115
caretaker note: it is advised to sync on its own, to more easily identify potential failures; this change has been heaviliy subject to backsliding. |
Removing the merge label since I still haven't submitted the fixes. Will re-apply once they're submitted. |
Another passing TGP after fixing a handful more failures. |
Ready to go now. |
This PR was merged into the repository by commit 09f589f. The changes were merged into the following branches: main |
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. |
Consider a template with a context variable
a
:An interpolation inside that template to
this.a
should intuitively read the class variablea
. However, today, it refers to the context variablea
, both in the TCB and the generated code.In this commit, the above interpolation now refers to the class field
a
.Fixes #55115