From e2f35e0af879acccc650fea806ec3eafde6e42ee Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Wed, 17 Jul 2024 15:15:36 -0500 Subject: [PATCH] Fix type_of for pointer types --- compiler/noirc_frontend/src/hir/comptime/value.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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),