From 5a9698e8cb8701b122cb484d5fef7e878dae6974 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Fri, 28 Jun 2024 09:08:57 +0100 Subject: Properly fix #3820 --- src/check_expr.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/check_expr.cpp') diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 27e750668..891378b99 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4431,9 +4431,14 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar defer (gb_string_free(type_str)); if (valid_count == 1) { + Type *new_type = t->Union.variants[first_success_index]; + target_type = new_type; + if (is_type_union(new_type)) { + convert_to_typed(c, operand, new_type); + break; + } + operand->type = new_type; operand->mode = Addressing_Value; - operand->type = t->Union.variants[first_success_index]; - target_type = t->Union.variants[first_success_index]; break; } else if (valid_count > 1) { ERROR_BLOCK(); -- cgit v1.2.3