Stream: bugs

Topic: Malformed (?) nested types compiler crash


view this post on Zulip Ryan Barth (Dec 03 2024 at 17:48):

Ran into this issue during AoC. Here is a minimal repro.

Bad source:

app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br" }

import pf.Stdout

main =
    Stdout.line! (Inspect.toStr (bar 3))


bar : U8 -> List List U8
bar = \x ->
    [[x, x, x]]

Running roc check on the above file yields

❯ roc check foo.roc
0 errors and 0 warnings found in 25 ms

But trying to actually build or run that file will get you a crash, kind of... It actually hangs with this error message and has to be killed with ctrl-c:

❯ RUST_BACKTRACE=1 roc build foo.roc
thread '<unnamed>' panicked at crates/compiler/mono/src/ir.rs:6166:56:
called `Option::unwrap()` on a `None` value
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
^C

Changing the type signature of bar to add parens to the output type fixes this:

app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br" }

import pf.Stdout

main =
    Stdout.line! (Inspect.toStr (bar 3))


bar : U8 -> List (List U8)
bar = \x ->
    [[x, x, x]]
❯ roc foo.roc
[[3, 3, 3]]

Compiler version:

❯ roc --version
roc nightly pre-release, built from commit a7168a4 on Mo 02 Dez 2024 09:02:13 UTC

view this post on Zulip Anton (Dec 03 2024 at 18:56):

Thanks for the minimal reproduction @Ryan Barth, I created #7303 for this


Last updated: Jul 06 2025 at 12:14 UTC