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

Missing parenthesis around callee for optional chaining call #4914

Closed
mischnic opened this issue Jun 9, 2022 · 1 comment · Fixed by #4923
Closed

Missing parenthesis around callee for optional chaining call #4914

mischnic opened this issue Jun 9, 2022 · 1 comment · Fixed by #4923
Labels
Milestone

Comments

@mischnic
Copy link
Contributor

mischnic commented Jun 9, 2022

Describe the bug

...

Input code

let a, b;
(a ?? b)?.();
(a ? b : null)?.();
(a ?? b)();
(a ? b : null)();

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": false
    },
    "target": "es2022",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": false
}

Playground link

https://play.swc.rs/?version=1.2.197&code=H4sIAAAAAAAAA8tJLVFI1FFIsubSSFSwt1dI0rTX09CE8BSSFKwU8kpzcpDEQCow5YEiAINqR2BJAAAA&config=H4sIAAAAAAAAA0WMOw4DIQxE7%2BKaIqJIsXfIISziXRHxk%2B1IQYi7BzZE241m3rwGL3GwNSjIQjyT1KT4gQ3IRRTHviiYgY1qxyDUDSjyQToRsTdrxxxyFlqAgeiT3%2BuUuRwLk8g1YTrCn%2BzDFfPzPYsGWgudzjv0y7F%2BXh4L%2FD2%2F%2F2Nc37kAAAA%3D

Expected behavior

= Input

Actual behavior

let a, b;
a ?? b?.();       // <-----
a ? b : null?.(); // <-----
(a ?? b)();
(a ? b : null)();

Version

1.2.197

Additional context

No response

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 16, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants