aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-05-02 22:47:19 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-05-02 22:47:19 -0400
commitaa6992613087f227df8f823e8ee41761c386840e (patch)
tree51ca0bcf43db4d1e1ab39b2c59e3f02abaa20a0c
parent126fd13c93b9c6531ab80a8c7cb01b4b491abc3e (diff)
Bugfix for integer math between Int and fixed-width int, where Int was
the second operand
-rw-r--r--src/compile.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compile.c b/src/compile.c
index 02d4795c..6dd10a20 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -580,6 +580,7 @@ static CORD compile_binary_op(env_t *env, ast_t *ast)
type_t *overall_t = get_type(env, ast);
binding_t *b = get_metamethod_binding(env, ast->tag, binop.lhs, binop.rhs, overall_t);
+ if (!b) b = get_metamethod_binding(env, ast->tag, binop.rhs, binop.lhs, overall_t);
if (b) {
arg_ast_t *args = new(arg_ast_t, .value=binop.lhs, .next=new(arg_ast_t, .value=binop.rhs));
DeclareMatch(fn, b->type, FunctionType);