diff --git a/compiler/noirc_frontend/src/monomorphization/mod.rs b/compiler/noirc_frontend/src/monomorphization/mod.rs index d3fb0d1ee12..6c7f07b68be 100644 --- a/compiler/noirc_frontend/src/monomorphization/mod.rs +++ b/compiler/noirc_frontend/src/monomorphization/mod.rs @@ -883,8 +883,7 @@ impl<'interner> Monomorphizer<'interner> { if let ast::Expression::Ident(ident) = original_func.as_ref() { if let Definition::Oracle(name) = &ident.definition { - let name_str = name.as_str(); - if (name_str == "println") | (name_str == "print") { + if name.as_str() == "print" { // Oracle calls are required to be wrapped in an unconstrained function // Thus, the only argument to the `println` oracle is expected to always be an ident self.append_printable_type_info(&hir_arguments[0], &mut arguments); diff --git a/noir_stdlib/src/lib.nr b/noir_stdlib/src/lib.nr index f271a2927ce..c8be3b2add4 100644 --- a/noir_stdlib/src/lib.nr +++ b/noir_stdlib/src/lib.nr @@ -21,13 +21,7 @@ mod string; mod test; // Oracle calls are required to be wrapped in an unconstrained function -// Thus, the only argument to the `println` oracle is expected to always be an ident -#[oracle(println)] -unconstrained fn println_oracle(_input: T) {} - -unconstrained pub fn println(input: T) { - println_oracle(input); -} +// Thus, the only argument to the `print` oracle is expected to always be an ident #[oracle(print)] unconstrained fn print_oracle(_input: T) {} @@ -36,6 +30,11 @@ unconstrained pub fn print(input: T) { print_oracle(input); } +unconstrained pub fn println(input: T) { + print(input); + print("\n"); +} + #[foreign(recursive_aggregation)] pub fn verify_proof( _verification_key: [Field], diff --git a/tooling/nargo/src/ops/foreign_calls.rs b/tooling/nargo/src/ops/foreign_calls.rs index 9014e839276..7af31afc2c3 100644 --- a/tooling/nargo/src/ops/foreign_calls.rs +++ b/tooling/nargo/src/ops/foreign_calls.rs @@ -15,7 +15,6 @@ pub trait ForeignCallExecutor { /// This enumeration represents the Brillig foreign calls that are natively supported by nargo. /// After resolution of a foreign call, nargo will restart execution of the ACVM pub(crate) enum ForeignCall { - Println, Print, Sequence, ReverseSequence, @@ -35,7 +34,6 @@ impl std::fmt::Display for ForeignCall { impl ForeignCall { pub(crate) fn name(&self) -> &'static str { match self { - ForeignCall::Println => "println", ForeignCall::Print => "print", ForeignCall::Sequence => "get_number_sequence", ForeignCall::ReverseSequence => "get_reverse_number_sequence", @@ -49,7 +47,6 @@ impl ForeignCall { pub(crate) fn lookup(op_name: &str) -> Option { match op_name { - "println" => Some(ForeignCall::Println), "print" => Some(ForeignCall::Print), "get_number_sequence" => Some(ForeignCall::Sequence), "get_reverse_number_sequence" => Some(ForeignCall::ReverseSequence), @@ -130,12 +127,6 @@ impl DefaultForeignCallExecutor { decode_string_value(&fields) } - fn execute_println(foreign_call_inputs: &[ForeignCallParam]) -> Result<(), ForeignCallError> { - let display_values: PrintableValueDisplay = foreign_call_inputs.try_into()?; - println!("{display_values}"); - Ok(()) - } - fn execute_print(foreign_call_inputs: &[ForeignCallParam]) -> Result<(), ForeignCallError> { let display_values: PrintableValueDisplay = foreign_call_inputs.try_into()?; print!("{display_values}"); @@ -150,12 +141,6 @@ impl ForeignCallExecutor for DefaultForeignCallExecutor { ) -> Result { let foreign_call_name = foreign_call.function.as_str(); match ForeignCall::lookup(foreign_call_name) { - Some(ForeignCall::Println) => { - if self.show_output { - Self::execute_println(&foreign_call.inputs)?; - } - Ok(ForeignCallResult { values: vec![] }) - } Some(ForeignCall::Print) => { if self.show_output { Self::execute_print(&foreign_call.inputs)?;