Stream: contributing

Topic: Compiler hangs when interface imports itself #3057


view this post on Zulip Rob (May 16 2022 at 23:03):

I'm working on this issue
I _think_ I've tracked down where I should check for the imports. compiler/parse/src/module.rs line 105. The interface_header function. It seems like this is where the imports are parsed as a collection. In my example code, I only have one import so I'm just taking the only item from the collection and matching on the Result but the type I end up with is tripping me up.
I end up with &roc_region::all::Loc<ast::Spaced<header::ImportsEntry>>

view this post on Zulip Rob (May 16 2022 at 23:05):

I think I want to somehow check to see if the parsed Module name in the same function matches a Module found in the imports collection

view this post on Zulip Ayaz Hafiz (May 16 2022 at 23:39):

Rather than doing the checking during parsing, you may want to take a look at parse_header and/or send_header in compiler/load_internal/src/file.rs, and perform the checking there. The reason being, this is more of a semantic error than a parse error. Line 2860 of load_internal/src/file.rs should give you an imports type that's easier to examine.

view this post on Zulip Rob (May 17 2022 at 14:22):

@Ayaz Hafiz ahhh ok, thanks so much!


Last updated: Jul 06 2025 at 12:14 UTC