[BUG hare build]: import cycle causes infinite recursion

Zachary Yedidia <zyedidia@stanford.edu>
Message ID
DKIM signature
Download raw message
I've come across a bug regarding import cycles. The following setup
causes a segmentation fault (due to stack overflow) in hare build.

In a/b/b.ha:

    use a;

    export const x1: int = 0
    export const x2: int = a::x1;

In a/a.ha:

    use a::b;

    export const x1: int = 0;
    export const x2: int = b::x1;

In main.ha:

    use a;
    export fn main() void = {

$ hare build
Segmentation fault (core dumped)

I believe the error is due to infinite recursion when resolving imports.

I'm not sure if import cycles are allowed in the language or not. I took
a glance at the spec, but it didn't seem to say anything about them.

Reply to thread Export thread (mbox)