Fix type of computed name following spread #39319
Merged
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.
Fixes #39278
We weren't checking the right set of property names - because of how a spread works, after a spread, there's a complete disjoint between the properties symbol array and the properties on the expression node - we tried to capture that with with an
offset
variable so we could still use the nodes we already have to look up symbol names, but while that sometimes worked when a spread added props (depending on which past state we're talking about), it didn't handle cases where a spread added zero properties. In any case, to fix this, I stop trying to associate the expression property list with the symbol property list (which has been error prone), and lookup names from the symbols, and, additionally, mark what slice of the property symbol array we need to be looking at (before #39083, the offset variable was trying to specify a slice of the node array list, but that didn't handle spreads well when it was matched back up to the symbol list).Context PRs: #12248 and more recently #39083