commit 82ab160673910c73fcbf6a038d200cf2b099fac3
parent 9dde107021c87221c8066f2721106b8c74298a58
Author: Eyal Sawady <ecs@d2evs.net>
Date: Sat, 27 Feb 2021 16:05:47 -0500
check: fix tagged union tuple hints
To avoid considering tuples with extra members as possibilities. Fixes
this code:
let x: ((str, str, str) | (str, str)) = ("foo", "bar");
assert(x is (str, str));
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/check.c b/src/check.c
@@ -2067,7 +2067,7 @@ check_expr_tuple(struct context *ctx,
ttuple = ttuple->next;
etuple = etuple->next;
}
- if (valid) {
+ if (!ttuple && valid) {
expr->result = type_dealias(tu->type);
break;
}