From c5db5fef62fb6cc24655bd8f271da313bd16b9a1 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 12 Dec 2024 14:01:48 -0500 Subject: Fix optional promotion issue --- types.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types.c b/types.c index 966698ad..f526af60 100644 --- a/types.c +++ b/types.c @@ -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); -- cgit v1.2.3