From 2c4f6536a34cb55a5dcaf73908b7ea056da802a9 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 13 Aug 2024 02:51:10 -0400 Subject: Fix Int->Num promotions --- compile.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 8f796bb2..77157d43 100644 --- a/compile.c +++ b/compile.c @@ -36,6 +36,11 @@ static bool promote(env_t *env, CORD *code, type_t *actual, type_t *needed) return true; } + if (actual->tag == IntType && Match(actual, IntType)->bits == 0 && needed->tag == NumType) { + *code = CORD_all("Int$as_num(", *code, ")"); + return true; + } + if (actual->tag == IntType || actual->tag == NumType) return true; -- cgit v1.2.3