Skip to content

Panic: LIR lowering expected layouts to match or differ by an explicit Box edge #10203

Description

@niclas-ahden

roc build panics on valid code (roc check is clean) with:

postcheck invariant violated: LIR lowering expected layouts to match or
differ by an explicit Box edge

We need three files to reproduce:

Foo.roc:

Foo := [
    Node(List(Foo.Qux), List(Foo)),
].{
    Qux := [Wrap(Box(Str -> Str))]

    wrap : { items : List(Foo) } -> Foo
    wrap = |args|
        Node([], args.items)
}

Bar.roc:

import Foo exposing [Foo]

Bar := [].{
    build : List(Str) -> Foo
    build = |model|
        Foo.wrap(
            {
                items: [
                    Foo.Node(
                        [Foo.Qux.Wrap(Box.box(|_v| "made"))],
                        model.map(|_s| Foo.Node([], [])),
                    ),
                ],
            },
        )
}

main.roc (on the test/fx platform):

app [main!] { pf: platform "../platform/main.roc" }

import pf.Stdout
import Bar

main! = || {
    _foo = Bar.build([])
    Stdout.line!("done")
}

Tested on NixOS, x86, Roc 317e608ca2.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions