Skip to content

Bug: Dangling else in function calls #5163

@Inve1951

Description

@Inve1951

I remember discussing dangling else in this repo but I can't seem to find the issue anymore. We did not discuss this specific case tho and I do think it's a bug.

Input Code

if coffee then if latte then 1 else 0

if coffee then brew if latte then 1 else 0

Expected Behavior

if (coffee) {
  if (latte) {
    1;
  } else {
    0;
  }
}

if (coffee) {
  brew(latte ? 1 : 0);
}

Current Behavior

if (coffee) {
  if (latte) {
    1;
  } else {
    0;
  }
}

if (coffee) {
  brew(latte ? 1 : void 0);
} else {
  0;
}

Possible Solution

Context

Environment

  • CoffeeScript version: 2.3.2
  • Node.js version: any

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions