mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Fix #5506
This commit is contained in:
@@ -9248,6 +9248,20 @@ gb_internal ExprKind check_ternary_if_expr(CheckerContext *c, Operand *o, Ast *n
|
|||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (x.mode == Addressing_Builtin && y.mode == Addressing_Builtin) {
|
||||||
|
if (type_hint == nullptr) {
|
||||||
|
error(node, "Built-in procedures cannot be used within a ternary expression since they have no well-defined signature");
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x.mode == Addressing_ProcGroup && y.mode == Addressing_ProcGroup) {
|
||||||
|
if (type_hint == nullptr) {
|
||||||
|
error(node, "Procedure groups cannot be used within a ternary expression since they have no well-defined signature that can be inferred without a context");
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE(bill, 2023-01-30): Allow for expression like this:
|
// NOTE(bill, 2023-01-30): Allow for expression like this:
|
||||||
// x: union{f32} = f32(123) if cond else nil
|
// x: union{f32} = f32(123) if cond else nil
|
||||||
if (type_hint && !is_type_any(type_hint)) {
|
if (type_hint && !is_type_any(type_hint)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user