diff --git a/compiler/noirc_frontend/src/hir/comptime/value.rs b/compiler/noirc_frontend/src/hir/comptime/value.rs index 9eeb323d664..e9955b1f9a8 100644 --- a/compiler/noirc_frontend/src/hir/comptime/value.rs +++ b/compiler/noirc_frontend/src/hir/comptime/value.rs @@ -80,9 +80,13 @@ impl Value { Value::Slice(_, typ) => return Cow::Borrowed(typ), Value::Code(_) => Type::Quoted(QuotedType::Quoted), Value::StructDefinition(_) => Type::Quoted(QuotedType::StructDefinition), - Value::Pointer(element, _) => { - let element = element.borrow().get_type().into_owned(); - Type::MutableReference(Box::new(element)) + Value::Pointer(element, auto_deref) => { + if *auto_deref { + element.borrow().get_type().into_owned() + } else { + let element = element.borrow().get_type().into_owned(); + Type::MutableReference(Box::new(element)) + } } Value::TraitConstraint { .. } => Type::Quoted(QuotedType::TraitConstraint), Value::TraitDefinition(_) => Type::Quoted(QuotedType::TraitDefinition),