roc icon indicating copy to clipboard operation
roc copied to clipboard

`mono` panic for inline expect in platform `interface` module

Open rtfeldman opened this issue 2 years ago • 1 comments

This can be reproduced on ec93e024175167fe6906f979f09c5901262dc595 with roc build examples/platform-switching/rocLovesC.roc (roc check passes) - that file has been modified to call a new function from pf.Dep, namely:

interface Dep
    exposes [strIdentity]
    imports []

strIdentity : Str -> Str
strIdentity = \input ->
    expect Bool.true

    input

This panics with:

'if expects are compiled, their subs should be available', crates/compiler/mono/src/ir.rs:6797:40

Everything works if you either:

  • remove the inline expect, or:
  • move Dep.roc out of the platform and into the application

So it seems to be a bug specifically with inline expects in other packages.

rtfeldman avatar Jul 20 '23 00:07 rtfeldman

Just ran into this bug while writing my roc-book chapter code.

I commented out the inline expects in roc-lang/unicode as a workaround for this issue.

lukewilliamboswell avatar Mar 08 '24 07:03 lukewilliamboswell