~sircmpwn/hare-users

[BUG hare build]: import cycle causes infinite recursion

Zachary Yedidia <zyedidia@stanford.edu>
Details
Message ID
<BYAPR02MB493603D53D8D685A0E063134B0739@BYAPR02MB4936.namprd02.prod.outlook.com>
DKIM signature
pass
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 = {
        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.

Thanks,
Zach
Reply to thread Export thread (mbox)