diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-12-21 15:13:26 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-12-21 15:13:26 -0500 |
| commit | 325b367a1342826fe7174ce45cfab92091d4dbb5 (patch) | |
| tree | 921b306025e495f71f008f9f9a4b1291ce2cdcb3 /types.c | |
| parent | 478ddad9aaf837005f5401126f8872c0e3058bba (diff) | |
Support logical binary operators on optionals (promote to booleans)
Diffstat (limited to 'types.c')
| -rw-r--r-- | types.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -358,6 +358,9 @@ PUREFUNC bool can_promote(type_t *actual, type_t *needed) return true; if (actual->tag == OptionalType) { + if (needed->tag == BoolType) + return true; + // Ambiguous `none` to concrete optional if (Match(actual, OptionalType)->type == NULL) return (needed->tag == OptionalType); |
