Allow assigning subtypes to unions

This commit is contained in:
gingerBill
2026-04-21 16:35:57 +01:00
parent a970a5c35b
commit 92c17b85e1

View File

@@ -891,7 +891,7 @@ gb_internal i64 check_distance_between_types(CheckerContext *c, Operand *operand
if (score >= 0) {
return score+2;
}
} else if (is_type_untyped(src)) {
} else if (is_type_untyped(src) || is_type_struct(type_deref(src))) { // allow for subtyping of structs
i64 prev_lowest_score = -1;
i64 lowest_score = -1;
for (Type *vt : dst->Union.variants) {