Skip to content

ICE: moonc crashes when argument |> tuple struct constructor #1266

Description

@id-map

moonc crashes when using |> to inserts the first argument of the tuple struct constructor (at least 2 arguments).

cmd

moonc compile example.mbt -w -unused_constructor

Code

  • Target: all
// example.mbt

priv struct Tuple2(Int, Int,)
// Int can be replaced by any type

fn main {
  // error!
  let _ = 1 |> Tuple2(1)

  // no error.
  // let _ = Tuple2(1) <| 1
  // let _ = Tuple2(1, 1)
}

Environment

  • OS: Windows
  • OS distribution and/or version: 11
  • CPU Architecture: x86_64
<versions>
moon 0.1.20260608 (60bc8c3 2026-06-08) ~\.moon\bin\moon.exe
moonc v0.10.0+e66899a54 (2026-06-09) ~\.moon\bin\moonc.exe
moonrun 0.1.20260608 (60bc8c3 2026-06-08) ~\.moon\bin\moonrun.exe

Feature flags enabled: rr_moon_mod,rr_moon_pkg

Error output

         --  --
       /  //  / __--------_
      /  //  /_/            \
   ---      -                \ __
  / X        /        ____   /   )
  *_________/__/_____/______/ `--

Oops, the compiler has encountered an unexpected situation.
This is a bug in the compiler.

A bug report containing the error description and relevant code would be
greatly appreciated. You can submit the bug report here:

  https://github.com/moonbitlang/moonbit-docs/issues/new?template=ice.md

Error: File "moonc.ml", line 282495, characters 24-30: Assertion failed

Compiler args: moonc compile example.mbt -w -unused_constructor

moonc version: v0.10.0+e66899a54

Metadata

Metadata

Assignees

Labels

ICEInternal Compiler ErrorbugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions