roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.4k stars 309 forks source link

Minimal `roc check` compiler bug when `roc build` succeeds #7175

Open drewolson opened 6 days ago

drewolson commented 6 days ago

roc check seems to often fail in multi-file projects when run on any file other than main.roc. In these cases, roc build still succeeds. Here's the simplest reproduction I could come up with.

$ tree
.
├── MyStr.roc
└── main.roc

1 directory, 2 files

$ cat MyStr.roc 
module [MyStr]

MyStr : Str

$ cat main.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
import MyStr exposing [MyStr]

greeting : MyStr
greeting =
    "hello"

main : Task {} _
main =
    Stdout.line! greeting

$ roc run
hello

$ roc check MyStr.roc 
An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
Outstanding references to the derived module
Location: crates/compiler/load_internal/src/file.rs:3299:29
Anton-4 commented 5 days ago

Linking to some very similar issues #7127 #7074 #6835