roc icon indicating copy to clipboard operation
roc copied to clipboard

Inspect recursive tag unions triggers a panic in the compiler

Open konnik opened this issue 1 year ago • 0 comments

This program triggers a panic in the compiler.

$ roc --version
roc nightly pre-release, built from commit bf5b13e237f on Wed Oct  9 09:13:56 UTC 2024

Panic.roc:

app [main] {
    pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
}

import pf.Stdout

main =
    # Note: if the type annotation below is removed the compiler won't panic any more
    x : X
    x = A
    _ = Inspect.toStr x
    Stdout.line "Nope"

X : [
    A,
    B (List X),
    C (List (Str, X)),
]

Error:

$ roc build Panic.roc 
thread 'main' panicked at crates/compiler/mono/src/borrow.rs:396:34:
internal error: entered unreachable code: 
	No borrow signature for LambdaName { name: `2.IdentId(18)`, niche: Niche(Captures([InLayout(245)])) } layout.

	Tip 1: This can happen when you call a function with less arguments than it expects.
	Like `Arg.list!` instead of `Arg.list! {}`.
	Tip 2: `roc check yourfile.roc` can sometimes give you a helpful error. 
                            
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

konnik avatar Oct 12 '24 16:10 konnik