Skip to content

Commit

Permalink
Merge 79d5387 into 426f295
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher authored Sep 18, 2024
2 parents 426f295 + 79d5387 commit f048f84
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/comptime/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "regression_6077"
type = "bin"
authors = [""]
compiler_version = ">=0.30.0"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a = 0
28 changes: 28 additions & 0 deletions test_programs/compile_success_empty/regression_6077/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
struct WeirdStruct<T, U> {
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() {}

0 comments on commit f048f84

Please sign in to comment.