From #7074:
if there is a main.roc
file in the same dir as the file being checked then roc check <anything>
attempts to compile/invoke that main.roc file, leading to the compiler error. I tested this in a clean dir:
mkdir Roc
cd Roc
cp ../IDCounter.roc ./
touch main.roc
roc check IDCounter.roc
.. throws a -- MISSING HEADER in main.roc --
error
It does seem like we should not complain about errors in main.roc if the user explicitly passes a filename.roc that does not depend on dependencies declared in main.roc. Is there something that makes this decoupling impossible or very difficult?
We do have to parse main.roc
to resolve packages, but I guess we can skip that if the module doesn’t import any
This error only happens if main.roc
exists, right? I think check
is supposed to work without it
If that’s the case, having an empty main.roc
file seems like a bit of an edge case that I am not convinced we need to support
It's not just an empty main.roc file, if I put a valid hello world in main.roc I also get:
❯ roc check IDCounter.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:3298:29
Last updated: Jul 06 2025 at 12:14 UTC