From e7411416694edb74ef182838a1ef17897144ccff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Gir=C3=A1ldez?= Date: Mon, 12 Feb 2024 14:38:17 -0500 Subject: [PATCH] fix: Don't put names in a function's PrintableType --- compiler/noirc_frontend/src/hir_def/types.rs | 6 +++--- compiler/noirc_printable_type/src/lib.rs | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/compiler/noirc_frontend/src/hir_def/types.rs b/compiler/noirc_frontend/src/hir_def/types.rs index 063969f0fa2..35e3ef7fa90 100644 --- a/compiler/noirc_frontend/src/hir_def/types.rs +++ b/compiler/noirc_frontend/src/hir_def/types.rs @@ -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) => { diff --git a/compiler/noirc_printable_type/src/lib.rs b/compiler/noirc_printable_type/src/lib.rs index c78722501db..60f233cd86d 100644 --- a/compiler/noirc_printable_type/src/lib.rs +++ b/compiler/noirc_printable_type/src/lib.rs @@ -33,8 +33,8 @@ pub enum PrintableType { length: u64, }, Function { - name: String, - arguments: Vec<(String, PrintableType)>, + arguments: Vec, + return_type: Box, env: Box, }, MutableReference { @@ -178,11 +178,8 @@ fn to_string(value: &PrintableValue, typ: &PrintableType) -> Option { output.push_str("false"); } } - (PrintableValue::Field(_), PrintableType::Function { name, arguments, .. }) => { - output.push_str(&format!( - "<>", - arguments.iter().map(|(var_name, _)| { var_name }) - )); + (PrintableValue::Field(_), PrintableType::Function { arguments, return_type, .. }) => { + output.push_str(&format!("< {:?}>>", arguments, return_type,)); } (_, PrintableType::MutableReference { .. }) => { output.push_str("<>");