With a main.ha of
use module;
export fn main() void = void;
and a module/module.ha of
export type foo = enum {
ONE,
};
export type error = !foo;
export fn get() (void | error) = void;
attempting to compile with hare build
complains:
Cannot use unexported type !module::foo in exported declaration 'module::error'
Error: harec: exited with status 1
hare build: build failed
Despite the fact that foo
is in fact exported.
This works if error
is not defined as an error type.
The problem is only with enums; this works if foo
is defined instead as a scalar, slice, struct, or union.
I believe I've narrowed done the problem to this case in
emit_type()
: https://git.sr.ht/~sircmpwn/harec/tree/master/item/src/typedef.c#L301With some print debugging I have determined that
type->alias.exported
is not set forfoo
. Thereforeemit_type()
returns false when called below, here: https://git.sr.ht/~sircmpwn/harec/tree/master/item/src/typedef.c#L329Furthermore, if in my test program above, I comment out
error
andget()
, then my debugging print statements show thattype->alias.exported
is set forfoo
. Weird!Hopefully someone with a bit more familiarity with the codebase might be able to solve this faster than I can.
Fixed in 7d1f4cf5f3b34969dda64eeec345c1f21e58967b