gleam-lang/gleam

Invalid JavaScript generated for case in a pipeline

已关闭

#5,743 创建于 2026年5月22日

 (2 条评论) (0 个反应) (0 位负责人)Rust (960 个派生)batch import
help wantedhigh priority

仓库指标

星标
 (21,417 个星标)
PR 合并指标
 (平均合并 10天 19小时) (30 天内合并 69 个 PR)

描述

  • 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);
}

贡献者指南