diff --git a/crates/nargo_cli/tests/test_data_ssa_refactor/references/src/main.nr b/crates/nargo_cli/tests/test_data_ssa_refactor/references/src/main.nr index 10d8cd25152..60b3c372fbd 100644 --- a/crates/nargo_cli/tests/test_data_ssa_refactor/references/src/main.nr +++ b/crates/nargo_cli/tests/test_data_ssa_refactor/references/src/main.nr @@ -2,10 +2,9 @@ fn main(mut x: Field) { add1(&mut x); assert(x == 3); - // https://github.com/noir-lang/noir/issues/1899 - // let mut s = S { y: x }; - // s.add2(); - // assert(s.y == 5); + let mut s = S { y: x }; + s.add2(); + assert(s.y == 5); // Test that normal mutable variables are still copied let mut a = 0; diff --git a/crates/noirc_frontend/src/hir/type_check/expr.rs b/crates/noirc_frontend/src/hir/type_check/expr.rs index 8afb4c0640e..5b89f72841b 100644 --- a/crates/noirc_frontend/src/hir/type_check/expr.rs +++ b/crates/noirc_frontend/src/hir/type_check/expr.rs @@ -524,8 +524,8 @@ impl<'interner> TypeChecker<'interner> { operator: crate::UnaryOp::Dereference, rhs: old_lhs, })); - this.interner.push_expr_type(access_lhs, lhs_type); - this.interner.push_expr_type(&old_lhs, element); + this.interner.push_expr_type(&old_lhs, lhs_type); + this.interner.push_expr_type(access_lhs, element); }; match self.check_field_access(&lhs_type, &access.rhs.0.contents, span, dereference_lhs) { @@ -939,7 +939,7 @@ impl<'interner> TypeChecker<'interner> { Type::MutableReference(Box::new(rhs_type.follow_bindings())) } crate::UnaryOp::Dereference => { - let element_type = Type::type_variable(self.interner.next_type_variable_id()); + let element_type = self.interner.next_type_variable(); unify(Type::MutableReference(Box::new(element_type.clone()))); element_type }