diff --git a/compiler/noirc_frontend/src/hir/comptime/value.rs b/compiler/noirc_frontend/src/hir/comptime/value.rs index f2cb714deb4..b027d069536 100644 --- a/compiler/noirc_frontend/src/hir/comptime/value.rs +++ b/compiler/noirc_frontend/src/hir/comptime/value.rs @@ -682,7 +682,7 @@ impl<'value, 'interner> Display for ValuePrinter<'value, 'interner> { } } Value::Zeroed(typ) => write!(f, "(zeroed {typ})"), - Value::Type(typ) => write!(f, "{:?}", typ), + Value::Type(typ) => write!(f, "{}", typ), Value::Expr(ExprValue::Expression(expr)) => { write!(f, "{}", remove_interned_in_expression_kind(self.interner, expr.clone())) } diff --git a/test_programs/compile_success_empty/regression_6077/Nargo.toml b/test_programs/compile_success_empty/regression_6077/Nargo.toml new file mode 100644 index 00000000000..0c1118245f4 --- /dev/null +++ b/test_programs/compile_success_empty/regression_6077/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "regression_6077" +type = "bin" +authors = [""] +compiler_version = ">=0.30.0" + +[dependencies] diff --git a/test_programs/compile_success_empty/regression_6077/Prover.toml b/test_programs/compile_success_empty/regression_6077/Prover.toml new file mode 100644 index 00000000000..ba3522cab01 --- /dev/null +++ b/test_programs/compile_success_empty/regression_6077/Prover.toml @@ -0,0 +1 @@ +a = 0 diff --git a/test_programs/compile_success_empty/regression_6077/src/main.nr b/test_programs/compile_success_empty/regression_6077/src/main.nr new file mode 100644 index 00000000000..fe067177e77 --- /dev/null +++ b/test_programs/compile_success_empty/regression_6077/src/main.nr @@ -0,0 +1,28 @@ +struct WeirdStruct { + a: T, + b: U, +} + +#[mangle_fn] +pub fn my_fn() -> [u8; 3] { + [0; 3] +} + +comptime fn mangle_fn(f: FunctionDefinition) { + let return_type = f.return_type(); + + // This relies on how types are displayed + let generics = f"Field,{return_type}".quoted_contents(); + let new_return_type = quote { WeirdStruct<$generics>}.as_type(); + + let new_body = quote { + { + WeirdStruct { a: 1, b: [0;3] } + } + }.as_expr().unwrap(); + + f.set_return_type(new_return_type); + f.set_body(new_body); +} + +fn main() {}