Skip to content
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

fix(compiler-cli): do not throw when retrieving TCB symbol for signal input with restricted access #55774

Closed

Conversation

devversion
Copy link
Member

Currently when attempting to retrieve a TCB symbol for an input binding that refers to a signal input with e.g. protected, while the honorAccessModifiersForInputBindings flag is false, Angular will throw a runtime exception because the symbol retrieval code always expects a proper field access in the TCB.

This is not the case with honorAccessModifiersForInputBindings = false, as TCB will allocate a temporary variable when ignoring the field access. This will then trigger the runtime exception (which we added to flag such "unexpected" cases). This commit handles it gracefully, as it's valid TCB, but we simply cannot generate a proper TCB symbol (yet). This is similar to @Input decorator inputs.

In the future we may implement logic to build up TCB symbols for non-property access bindings, for both signal inputs or @Input inputs. This commit just avoids a build exception.

Related to: #54324.

@devversion devversion 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 labels May 13, 2024
… input with restricted access

Currently when attempting to retrieve a TCB symbol for an input binding
that refers to a signal input with e.g. `protected`, while the
`honorAccessModifiersForInputBindings` flag is `false`, Angular will
throw a runtime exception because the symbol retrieval code always
expects a proper field access in the TCB.

This is not the case with `honorAccessModifiersForInputBindings =
false`, as TCB will allocate a temporary variable when ignoring the
field access. This will then trigger the runtime exception (which we
added to flag such "unexpected" cases). This commit handles it
gracefully, as it's valid TCB, but we simply cannot generate a proper
TCB symbol (yet). This is similar to `@Input` decorator inputs.

In the future we may implement logic to build up TCB symbols for
non-property access bindings, for both signal inputs or `@Input`
inputs. This commit just avoids a build exception.

Related to: angular#54324.
@devversion devversion force-pushed the throw-symbol-input-restricted branch from f6f0306 to 1ff8a06 Compare May 13, 2024 12:31
@devversion devversion marked this pull request as ready for review May 13, 2024 12:31
@devversion devversion 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 May 16, 2024
@atscott atscott added target: rc This PR is targeted for the next release-candidate and removed target: patch This PR is targeted for the next patch release labels May 16, 2024
@atscott
Copy link
Contributor

atscott commented May 16, 2024

This PR was merged into the repository by commit 400911e.

atscott pushed a commit that referenced this pull request May 16, 2024
… input with restricted access (#55774)

Currently when attempting to retrieve a TCB symbol for an input binding
that refers to a signal input with e.g. `protected`, while the
`honorAccessModifiersForInputBindings` flag is `false`, Angular will
throw a runtime exception because the symbol retrieval code always
expects a proper field access in the TCB.

This is not the case with `honorAccessModifiersForInputBindings =
false`, as TCB will allocate a temporary variable when ignoring the
field access. This will then trigger the runtime exception (which we
added to flag such "unexpected" cases). This commit handles it
gracefully, as it's valid TCB, but we simply cannot generate a proper
TCB symbol (yet). This is similar to `@Input` decorator inputs.

In the future we may implement logic to build up TCB symbols for
non-property access bindings, for both signal inputs or `@Input`
inputs. This commit just avoids a build exception.

Related to: #54324.

PR Close #55774
@atscott atscott closed this in 400911e May 16, 2024
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 target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants