diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-11-02 15:21:12 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-11-02 15:21:12 +0000 |
| commit | ee36f6fe33d41a37ea7d9cdc32d67d05c78d54e6 (patch) | |
| tree | a847470a15c61e003f7a733e6ca1c6d3f88a2403 | |
| parent | 7f2ab31acc411fa33438407fd41a3c2a1b3bc46a (diff) | |
Fix #5506
| -rw-r--r-- | src/check_expr.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index e22f12323..e02fee05e 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -9248,6 +9248,20 @@ gb_internal ExprKind check_ternary_if_expr(CheckerContext *c, Operand *o, Ast *n 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: // x: union{f32} = f32(123) if cond else nil if (type_hint && !is_type_any(type_hint)) { |