diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-28 09:08:57 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-28 09:08:57 +0100 |
| commit | 5a9698e8cb8701b122cb484d5fef7e878dae6974 (patch) | |
| tree | 37854a3dfaaa568d06d1b98a7835d69c4b3cafc5 /src/check_expr.cpp | |
| parent | 0c8a81d298797b19e382ec6b2cfea87c448c1ac8 (diff) | |
Properly fix #3820
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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(); |