forgottend typecheck on a struct

This commit is contained in:
Jakub Doka 2024-10-25 15:31:49 +02:00
parent 62a7c61cdc
commit 423361a80e
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -2316,7 +2316,7 @@ impl<'a> Codegen<'a> {
self.ci.nodes.unlock(lhs.id); self.ci.nodes.unlock(lhs.id);
let mut rhs = rhs?; let mut rhs = rhs?;
self.strip_var(&mut 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]; let inps = [VOID, lhs.id, rhs.id];
Some(self.ci.nodes.new_node_lit( Some(self.ci.nodes.new_node_lit(
ty::bin_ret(ty, op), ty::bin_ret(ty, op),
@ -2330,6 +2330,7 @@ impl<'a> Codegen<'a> {
self.ci.nodes.unlock(lhs.id); self.ci.nodes.unlock(lhs.id);
let mut rhs = rhs?; let mut rhs = rhs?;
self.strip_var(&mut 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]); 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); self.struct_op(left.pos(), op, s, dst, lhs.id, rhs.id);
Some(Value::ptr(dst).ty(lhs.ty)) Some(Value::ptr(dst).ty(lhs.ty))