Skip to content

Avoid new SSA var for ASSIGN_OBJ_REF without RC inference #13233

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

iluuu1994
Copy link
Member

@iluuu1994 iluuu1994 commented Jan 23, 2024

Previously, this variable was necessary because of auto-vivification on UNDEF/NULL/false. It's now only used for RC inference, as auto-vivification has been removed.

This implicitly solves an inference problem for $obj->bar &= $obj; where we get a new variable for both literal references to $obj, with the first one getting the RCn flag, and the second one getting the MAY_BE_REFERENCE flag. Thus, the first variable will be missing the reference type, causing a false-positive type inference warning.

If we want to verify RC inference at some point we'll need a better solution.

For reference: https://github.com/php/php-src/actions/runs/7619720239/job/20753304348

Previously, this variable was necessary because of auto-vivification on
UNDEF/NULL/false. It's now only used for RC inference. However,
auto-vivification has been removed.

This implicitly solves an inference problem for $obj->bar &= $obj; where we get
a new variable for both literal references to $obj, with the first one getting
the RCn flag, and the second one getting the MAY_BE_REFERENCE flag. Thus, the
first variable will be missing the reference type, causing a false-positive type
inference warning.

If we want to verify RC inference at some point we'll need a better solution.
@iluuu1994 iluuu1994 requested a review from dstogov as a code owner January 23, 2024 18:16
@iluuu1994 iluuu1994 changed the title Avoid new var for SSA for ASSIGN_OBJ_REF without RC inference Avoid new SSA var for ASSIGN_OBJ_REF without RC inference Jan 23, 2024
@iluuu1994 iluuu1994 closed this in 6f6289c Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants