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

Incorrect javascript produced for nested single line if..else statements. v10.3.0-v11.0.1 #118

Closed
Aglartur opened this issue Jan 23, 2024 · 1 comment
Labels

Comments

@Aglartur
Copy link

Aglartur commented Jan 23, 2024

I encountered an error where incorrect javascript is produced when minifed. Surprisingly it works in 9.2.0
Original code:

let a;
let b;

if (a) {
  if (b) {
    console.log("a and b are truthy");
  } else {
    console.log("a is truthy, b is falsy");
  }
}

Incorrect code (v10.3.0-v11.0.1). If a is falsy, then console.log("a is truthy, b is falsy")' gets triggered incorrectly.

let a;
let b;
a && b
  ? console.log("a and b are truthy")
  : console.log("a is truthy, b is falsy");

Correct code (v9.2.0)

let a, b;
a &&
  (b
    ? console.log("a and b are truthy")
    : console.log("a is truthy, b is falsy"));
@coderaiser coderaiser added the bug label Jan 24, 2024
coderaiser added a commit to coderaiser/putout that referenced this issue Jan 25, 2024
@coderaiser
Copy link
Owner

Just fixed in @putout/[email protected], please re-install Minify, is it works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants