harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6864ad7e04188d2c272a21f2367df09fe8210ab0
parent 4bdbec94afefec9a35656a055bb5bdc8f871366c
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Mon, 25 Apr 2022 23:08:26 +0000

eval: fix casts from aliases to tagged unions

Minimal reproduction:

type a = void;
const b: (a | int) = a;
export fn main() void = assert(b is a);

Signed-off-by: Eyal Sawady <ecs@d2evs.net>

Diffstat:
Msrc/eval.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/eval.c b/src/eval.c @@ -469,7 +469,7 @@ eval_cast(struct context *ctx, struct expression *in, struct expression *out) } return EVAL_OK; case STORAGE_TAGGED: - subtype = tagged_select_subtype(to, from); + subtype = tagged_select_subtype(to, val.result); out->constant.tagged.value = xcalloc(1, sizeof(struct expression)); if (subtype) {