~sircmpwn/hare-users

2 2

Using constant in switch-expr failes assertion

Details
Message ID
<87r0n8c261.fsf@tomsdiner.org>
DKIM signature
missing
Download raw message
Hi,

this code does not compile, use of `CONST` in the switch gives

harec: src/check.c:2889: casecmp: Assertion `a->result->storage == b->result->storage’ failed.


```
use os;

type error = !int;

def CONST: error = 1;

export fn main() void = {
        const e: error = 0;
        switch(e) {
        case 0 => os::exit(0);
        case CONST => os::exit(1);
        case => os::exit(2);
        };
};
```

If I define `CONST` as int, not an error type, the code compiles.

kind regards,
Tom
Details
Message ID
<CVDV39KN7VRI.KFA5R0AB7HRQ@notmylaptop>
In-Reply-To
<87r0n8c261.fsf@tomsdiner.org> (view parent)
DKIM signature
missing
Download raw message
Thanks for reporting this! I just sent a patchset which should fix this:
https://lists.sr.ht/~sircmpwn/hare-dev/patches/44524
Details
Message ID
<87zg1ue8er.fsf@tomsdiner.org>
In-Reply-To
<CVDV39KN7VRI.KFA5R0AB7HRQ@notmylaptop> (view parent)
DKIM signature
missing
Download raw message
“Sebastian” <sebastian@sebsite.pw> writes:

> Thanks for reporting this! I just sent a patchset which should fix this:
> <https://lists.sr.ht/~sircmpwn/hare-dev/patches/44524>

That was fast :-)
can confirm that my code compiles and runs again.

Thanks!
Reply to thread Export thread (mbox)