diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-11-04 15:24:10 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-11-04 15:24:10 -0500 |
| commit | 2fa26e6af3ec1599396d9260ef44b0d035b1f686 (patch) | |
| tree | f35124d2259af4183b222ef0f84a89f9286e9ea2 /typecheck.c | |
| parent | da5bd87c135749b11c866aaf341c6c2c7c2ab9b2 (diff) | |
Be much more permissive about using integer literals for fixed-size ints
or nums or bytes
Diffstat (limited to 'typecheck.c')
| -rw-r--r-- | typecheck.c | 7 |
1 files changed, 7 insertions, 0 deletions
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); \ |
