Skip to content

Commit

Permalink
Fix type_of for pointer types
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Jul 17, 2024
1 parent 30cb65a commit e2f35e0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions compiler/noirc_frontend/src/hir/comptime/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit e2f35e0

Please sign in to comment.