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

Allow binary operators after nested object literals and bulleted arrays, fix ++ with bulleted arrays #1688

Merged
merged 3 commits into from
Jan 22, 2025

Conversation

edemaine
Copy link
Collaborator

@edemaine edemaine commented Jan 22, 2025

Fixes #1687. This bug was introduced by #1628 which innocently added checking for NestedImplicitObjectLiterals next to NestedBulletedArrays in MaybeNestedExpression.

It turns out the "right" answer is to check for neither! Otherwise, we don't allow for binary operators after dedent after the nested object literal / bulleted array. Conveniently, we already check for NestedImplicitObjectLiteral and NestedBulletedArray within PrimaryExpression (as part of ObjectLiteral and ArrayLiteral respectively), so we don't need to do anything special here, except for stopping the PushIndent Nested PopIndent check in MaybeNestedExpression.

Along the way, I fixed another issue with the concat operator ++ followed by a bulleted array. Previously, this broke for two reasons: (1) UpdateExpression thought that this was an increment, despite the indentation after ++ (needed to explicitly !Whitespace to match the comment). (2) WRHS did need to check explicitly for NestedImplicitObjectLiteral and NestedBulletedArray, like MaybeNestedExpression used to. (Here it's the right thing to do, because any further binary operators will be handled by the parent BinaryExpression.)

Also fixed some unrelated CI issues that seem to have come up just from 2025 deprecations.

Copy link
Contributor

@STRd6 STRd6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@edemaine edemaine merged commit 3beb915 into main Jan 22, 2025
4 checks passed
@edemaine edemaine deleted the trailing-binary branch January 22, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression with dedented postfix after implicit object literal
2 participants