This commit is contained in:
Bärtschi Robin
2026-06-24 08:04:17 +02:00
parent 5647a1b2fc
commit 3883d079c8
2 changed files with 9 additions and 0 deletions

View File

@@ -113,6 +113,7 @@ destroy_value :: proc(value: Value, allocator := context.allocator, loc := #call
}
clone_value :: proc(value: Value, allocator := context.allocator) -> Value {
value := value
context.allocator = allocator
#partial switch &v in value {

View File

@@ -1476,6 +1476,14 @@ gb_internal void check_type_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_
return;
}
if (switch_kind == TypeSwitch_Union) {
if (is_addressed) {
if (x.mode != Addressing_Variable && !is_type_pointer(x.type)) {
error(lhs->Ident.token, "The element variable '%.*s' cannot be made addressable", LIT(lhs->Ident.token.string));
}
}
}
Ast *nil_seen = nullptr;
TypeSet seen = {};