Skip to content

Commit

Permalink
fix: Don't put names in a function's PrintableType
Browse files Browse the repository at this point in the history
  • Loading branch information
ggiraldez committed Feb 12, 2024
1 parent 3fae7dc commit e741141
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions compiler/noirc_frontend/src/hir_def/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1651,9 +1651,9 @@ impl From<&Type> for PrintableType {
Type::TypeVariable(_, _) => unreachable!(),
Type::NamedGeneric(..) => unreachable!(),
Type::Forall(..) => unreachable!(),
Type::Function(args, _, env) => PrintableType::Function {
name: "?".to_string(),
arguments: args.iter().map(|arg| ("?".to_string(), arg.into())).collect(),
Type::Function(arguments, return_type, env) => PrintableType::Function {
arguments: arguments.iter().map(|arg| arg.into()).collect(),
return_type: Box::new(return_type.as_ref().into()),
env: Box::new(env.as_ref().into()),
},
Type::MutableReference(typ) => {
Expand Down
11 changes: 4 additions & 7 deletions compiler/noirc_printable_type/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ pub enum PrintableType {
length: u64,
},
Function {
name: String,
arguments: Vec<(String, PrintableType)>,
arguments: Vec<PrintableType>,
return_type: Box<PrintableType>,
env: Box<PrintableType>,
},
MutableReference {
Expand Down Expand Up @@ -178,11 +178,8 @@ fn to_string(value: &PrintableValue, typ: &PrintableType) -> Option<String> {
output.push_str("false");
}
}
(PrintableValue::Field(_), PrintableType::Function { name, arguments, .. }) => {
output.push_str(&format!(
"<<fn {name}({:?})>>",
arguments.iter().map(|(var_name, _)| { var_name })
));
(PrintableValue::Field(_), PrintableType::Function { arguments, return_type, .. }) => {
output.push_str(&format!("<<fn({:?}) -> {:?}>>", arguments, return_type,));
}
(_, PrintableType::MutableReference { .. }) => {
output.push_str("<<mutable ref>>");
Expand Down

0 comments on commit e741141

Please sign in to comment.