gleam-lang/gleam

Invalid JavaScript generated for case in a pipeline

Chiusa

#5743 aperta il 22 mag 2026

 (2 commenti) (0 reazioni) (0 assegnatari)Rust (960 fork)batch import
help wantedhigh priority

Metriche repository

Star
 (21.417 stelle)
Metriche merge PR
 (Merge medio 10g 19h) (69 PR mergiate in 30 g)

Descrizione

  • gleam 1.16.0
  • target JS

This code gets compiled to an invalid JS file.

import gleam/function
import gleam/io

pub fn main() {
  0
  |> case True {
    True -> function.identity |> echo
    False -> fn(i) { i + 1 }
  }
  |> fn(i) { i + 1 }
}

Compiled to a JS file with this error: SyntaxError: Identifier '_pipe$1' has already been declared

export function main() {
  let _pipe = 0;
  let _block;
  let $ = true;
  let _pipe$1 = $function.identity;
  _block = echo(_pipe$1, undefined, "src/tmp_gleam.gleam", 7);
  let _pipe$1 = _block(_pipe);
  return ((i) => { return i + 1; })(_pipe$1);
}

Guida contributor