From 423361a80e3212353e3023c0443f28286470bbc1 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Fri, 25 Oct 2024 15:31:49 +0200 Subject: [PATCH] forgottend typecheck on a struct --- lang/src/son.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lang/src/son.rs b/lang/src/son.rs index c15e103..dcad7bd 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -2316,7 +2316,7 @@ impl<'a> Codegen<'a> { self.ci.nodes.unlock(lhs.id); let mut rhs = rhs?; self.strip_var(&mut rhs); - let ty = self.binop_ty(left.pos(), &mut lhs, &mut rhs, op); + let ty = self.binop_ty(right.pos(), &mut lhs, &mut rhs, op); let inps = [VOID, lhs.id, rhs.id]; Some(self.ci.nodes.new_node_lit( ty::bin_ret(ty, op), @@ -2330,6 +2330,7 @@ impl<'a> Codegen<'a> { self.ci.nodes.unlock(lhs.id); let mut rhs = rhs?; self.strip_var(&mut rhs); + self.assert_ty(right.pos(), &mut rhs, lhs.ty, "struct operand"); let dst = self.ci.nodes.new_node(lhs.ty, Kind::Stck, [VOID, MEM]); self.struct_op(left.pos(), op, s, dst, lhs.id, rhs.id); Some(Value::ptr(dst).ty(lhs.ty))