-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
[compiler][ez] rewrite invariant in InferReferenceEffects #32093
Conversation
Small patch to pass aliased context values into `Object|ArrayExpression`s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving since this is a strict improvement, but in a follow up we should generalize the check for context operands influencing the result kind
const contextRefOperands = getContextRefOperand(state, instrValue); | ||
const valueKind: AbstractValue = | ||
contextRefOperands.length > 0 | ||
? { | ||
kind: ValueKind.Context, | ||
reason: new Set([ValueReason.Other]), | ||
context: new Set(contextRefOperands), | ||
} | ||
: { | ||
kind: ValueKind.Mutable, | ||
reason: new Set([ValueReason.Other]), | ||
context: new Set(), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm it seems wrong to do this only for array and object expressions: there could just as easily be a function call or constructor that captures context values in the same way. I think we missed this when we originally added the context ref check — let's generalize this check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just slightly ahead of you, see repro here #31770
+1 on generalizing this check -- although I'm curious how many changes to compilation output this would result in
See test fixture --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32094). * #32099 * #32104 * #32098 * #32097 * #32096 * #32095 * __->__ #32094 * #32093
See test fixture --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32095). * #32099 * #32104 * #32098 * #32097 * #32096 * __->__ #32095 * #32094 * #32093
Small patch to pass aliased context values into
Object|ArrayExpression
sStack created with Sapling. Best reviewed with ReviewStack.