From bfdb2da9e12775a0caa8de35f1d114181918529a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 22 Feb 2024 13:09:46 -0500 Subject: Implement power (^) --- typecheck.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'typecheck.c') diff --git a/typecheck.c b/typecheck.c index ad1062d1..30ac197d 100644 --- a/typecheck.c +++ b/typecheck.c @@ -457,6 +457,12 @@ type_t *get_type(env_t *env, ast_t *ast) code_err(ast, "I can't compare these two different types: %T vs %T", lhs_t, rhs_t); return Type(BoolType); } + case BINOP_POWER: { + type_t *result = get_math_type(env, ast, lhs_t, rhs_t); + if (result->tag == NumType) + return result; + return Type(NumType, .bits=64); + } default: { return get_math_type(env, ast, lhs_t, rhs_t); } -- cgit v1.2.3