diff --git a/lang/src/son.rs b/lang/src/son.rs index 9e361e95..862166d6 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -1151,9 +1151,11 @@ impl<'a> Codegen<'a> { Some(Value::new(self.gen_null_check(cmped, ty, op)).ty(ty::Id::BOOL)) } - Expr::BinOp { left, pos, op, right } - if !matches!(op, TokenKind::Assign | TokenKind::Decl) => - { + Expr::BinOp { left, pos, op, right } => { + debug_assert!(!matches!( + op, + TokenKind::Assign | TokenKind::Decl | TokenKind::Colon + )); let mut lhs = self.ptr_expr_ctx(left, ctx)?; self.implicit_unwrap(left.pos(), &mut lhs); @@ -1768,6 +1770,25 @@ impl<'a> Codegen<'a> { Some(Value::ptr(mem).ty(aty)) } + (Some(ty::Kind::Tuple(tupl)), ListKind::Tuple) => { + let mem = self.new_stack(pos, tupl.into()); + let mut offs = OffsetIter::new(tupl, self.tys); + for field in fields { + let Some((ty, offset)) = offs.next_ty(self.tys) else { + self.error( + field.pos(), + "this init argumen overflows the field count", + ); + break; + }; + + let value = self.checked_expr(field, ty, "tuple field")?; + let mem = self.offset(mem, offset); + self.store_mem(mem, ty, value.id); + } + + Some(Value::ptr(mem).ty(tupl.into())) + } (Some(t), ListKind::Tuple) => self.error( pos, fa!(