aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-13 02:51:10 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-13 02:51:10 -0400
commit2c4f6536a34cb55a5dcaf73908b7ea056da802a9 (patch)
tree27de91078ac6c0c286b8d769d4b6a4b79d1d7b28 /compile.c
parentf4011eb489d97bbf3170c81a985a09568bfc0dd7 (diff)
Fix Int->Num promotions
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c5
1 files changed, 5 insertions, 0 deletions
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;