mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
fix not erroring on invalid ternary
For example: `a: f32 = true ? 1 : len` would get to the back-end without errors. Fixes #1690
This commit is contained in:
@@ -8795,11 +8795,6 @@ gb_internal ExprKind check_ternary_if_expr(CheckerContext *c, Operand *o, Ast *n
|
|||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.type == nullptr || x.type == t_invalid ||
|
|
||||||
y.type == nullptr || y.type == t_invalid) {
|
|
||||||
return kind;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool use_type_hint = type_hint != nullptr && (is_operand_nil(x) || is_operand_nil(y));
|
bool use_type_hint = type_hint != nullptr && (is_operand_nil(x) || is_operand_nil(y));
|
||||||
|
|
||||||
convert_to_typed(c, &x, use_type_hint ? type_hint : y.type);
|
convert_to_typed(c, &x, use_type_hint ? type_hint : y.type);
|
||||||
|
|||||||
Reference in New Issue
Block a user