roc-lang / roc

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

`roc check IDCounter.roc` also checks main.roc #7074

Open planmac opened 2 weeks ago

planmac commented 2 weeks ago

Got this error when running: roc check IDCounter.roc on the Full Code found at the end of this pg: https://www.roc-lang.org/examples/RecordBuilder/README.html

The full error message: 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

Platform: Apple silicon

Anton-4 commented 1 week ago

Thanks for reporting this @planmac!

I was not able to reproduce this error on ubuntu, can you share the output of roc version?

planmac commented 1 week ago

roc nightly pre-release, built from commit 9a4d556725 on Sat Sep 7 09:14:19 UTC 2024

Anton-4 commented 1 week ago

I'm still not able to reproduce it on ubuntu with that exact version. In 10 days I will have access to my mac again, and I'll give it a try then.

JRI98 commented 1 week ago

Can't reproduce on Apple M1

Anton-4 commented 1 week ago

Thanks @JRI98 :)

@planmac let's make super sure nothing weird happened, can you do:

wget https://raw.githubusercontent.com/roc-lang/examples/main/examples/RecordBuilder/IDCounter.roc
roc check IDCounter.roc
roc version
planmac commented 1 week ago

OK, I replicated the error - 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 Not sure if this is a feature or a bug ??

Anton-4 commented 1 week ago

Thanks for investigating this further @planmac, I've started a discussion on zulip.

Anton-4 commented 6 days ago

Looks like the original error also happens when I put a valid hello world in main.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

This should definitely not happen.