Skip to content

Incorrect minification with a bigint value created by a binary operator inside conditions #4065

@sapphi-red

Description

@sapphi-red

For input

export function foo(a, b) {
  if ((a | b) === 0) {
    throw new Error()
  }
}

esbuild outputs

export function foo(o,r){if(!(o|r))throw new Error}

But this changes the behavior when foo(0n, 0n) is called.
No error happens before minification, but an error happens after minification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions