From a182dc78f45cdbdca6675f945d3fbd5a61ca3250 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Thu, 31 Aug 2023 02:31:11 +0200 Subject: [PATCH] fix #2779 ternary with a union of enum --- src/check_expr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 399c25a9d..a0d3c24bf 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7927,7 +7927,7 @@ gb_internal ExprKind check_ternary_if_expr(CheckerContext *c, Operand *o, Ast *n // NOTE(bill, 2023-01-30): Allow for expression like this: // x: union{f32} = f32(123) if cond else nil - if (type_hint && !is_type_any(type_hint) && !ternary_compare_types(x.type, y.type)) { + if (type_hint && !is_type_any(type_hint)) { if (check_is_assignable_to(c, &x, type_hint) && check_is_assignable_to(c, &y, type_hint)) { check_cast(c, &x, type_hint); check_cast(c, &y, type_hint);