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

Fix bug with holes in array literals #7911

Merged
merged 3 commits into from
Mar 31, 2020
Merged

Fix bug with holes in array literals #7911

merged 3 commits into from
Mar 31, 2020

Conversation

bakkot
Copy link
Collaborator

@bakkot bakkot commented Mar 31, 2020

Fixes #7910, so that running Prettier against

new Test()
  .test()
  .test([, 0])
  .test();

no longer throws an error.

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/pr-XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@thorn0 thorn0 merged commit 18bf01e into master Mar 31, 2020
@@ -958,7 +958,7 @@ function isSimpleCallArgument(node, depth) {
);
}
if (node.type === "ArrayExpression") {
return node.elements.every(isChildSimple);
return node.elements.every((x) => x == null || isChildSimple(x));
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be === null ? holes always null

@alexander-akait alexander-akait deleted the holes-in-calls branch March 31, 2020 10:49
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error When Combining Method Chaining with Sparse Array Arguments
4 participants