diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-12-12 14:01:48 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-12-12 14:01:48 -0500 |
| commit | c5db5fef62fb6cc24655bd8f271da313bd16b9a1 (patch) | |
| tree | 2a977d24189d882456a3da6593310030763aadcb /types.c | |
| parent | ff95aa5e6442c76a229bb54758617bd278d4f709 (diff) | |
Fix optional promotion issue
Diffstat (limited to 'types.c')
| -rw-r--r-- | types.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -365,12 +365,12 @@ PUREFUNC bool can_promote(type_t *actual, type_t *needed) // Optional num -> num if (needed->tag == NumType && actual->tag == OptionalType && Match(actual, OptionalType)->type->tag == NumType) return can_promote(Match(actual, OptionalType)->type, needed); - - // Optional promotion: - if (needed->tag == OptionalType && Match(needed, OptionalType)->type != NULL && can_promote(actual, Match(needed, OptionalType)->type)) - return true; } + // Optional promotion: + if (needed->tag == OptionalType && Match(needed, OptionalType)->type != NULL && can_promote(actual, Match(needed, OptionalType)->type)) + return true; + if (needed->tag == PointerType && actual->tag == PointerType) { auto needed_ptr = Match(needed, PointerType); auto actual_ptr = Match(actual, PointerType); |
