[compiler] Patch array and argument spread mutability #32521
+656
−51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Array and argument spreads may mutate stateful iterables. Spread sites should have
ConditionallyMutate
effects (e.g. mutate if the ValueKind is mutable, otherwise read).See
Note that
todo-granular-iterator-semantics
), but this is not what we do today. As such, an array / argument spread will always extend the range of built-in arrays, sets, etcfreeze
,capture
, orread
semantics (e.g.useHook(...mutableValue)
)We can deal with this by rewriting these call instructions to (1) create an intermediate array to consume the iterator and (2) capture and spread the array at the callsite
Stack created with Sapling. Best reviewed with ReviewStack.