From e171d4a98caed10a7356d7cb78590cdf74443124 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 12 May 2024 19:21:44 -0400 Subject: Fix up some promotion logic for closures --- types.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'types.c') diff --git a/types.c b/types.c index ca0f77f3..f7270a98 100644 --- a/types.c +++ b/types.c @@ -268,7 +268,10 @@ bool can_promote(type_t *actual, type_t *needed) } if (needed->tag == ClosureType && actual->tag == FunctionType) - return type_eq(actual, Match(needed, ClosureType)->fn); + return can_promote(actual, Match(needed, ClosureType)->fn); + + if (needed->tag == ClosureType && actual->tag == ClosureType) + return can_promote(Match(actual, ClosureType)->fn, Match(needed, ClosureType)->fn); if (actual->tag == FunctionType && needed->tag == FunctionType) { for (arg_t *actual_arg = Match(actual, FunctionType)->args, *needed_arg = Match(needed, FunctionType)->args; -- cgit v1.2.3