From 2fa26e6af3ec1599396d9260ef44b0d035b1f686 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 4 Nov 2024 15:24:10 -0500 Subject: Be much more permissive about using integer literals for fixed-size ints or nums or bytes --- typecheck.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'typecheck.c') diff --git a/typecheck.c b/typecheck.c index 44068f5a..38b6f7fb 100644 --- a/typecheck.c +++ b/typecheck.c @@ -900,6 +900,13 @@ type_t *get_type(env_t *env, ast_t *ast) type_t *lhs_t = get_type(env, binop->lhs), *rhs_t = get_type(env, binop->rhs); + if (lhs_t->tag == BigIntType && rhs_t->tag != BigIntType && is_numeric_type(rhs_t) && binop->lhs->tag == Int) { + lhs_t = rhs_t; + } else if (rhs_t->tag == BigIntType && lhs_t->tag != BigIntType && is_numeric_type(lhs_t) && binop->rhs->tag == Int) { + + rhs_t = lhs_t; + } + #define binding_works(name, self, lhs_t, rhs_t, ret_t) \ ({ binding_t *b = get_namespace_binding(env, self, name); \ (b && b->type->tag == FunctionType && ({ auto fn = Match(b->type, FunctionType); \ -- cgit v1.2.3