From 2383d73645d0a72ea535e49899d9e35ac39a296d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 17 Aug 2024 15:14:45 -0400 Subject: Correct the logic to prevent promoting nums to ints automatically --- compile.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'compile.c') diff --git a/compile.c b/compile.c index e15d8801..e8ed8c79 100644 --- a/compile.c +++ b/compile.c @@ -41,6 +41,9 @@ static bool promote(env_t *env, CORD *code, type_t *actual, type_t *needed) return true; } + if (actual->tag == NumType && needed->tag == IntType) + return false; + if (actual->tag == IntType || actual->tag == NumType) return true; -- cgit v1.2.3