Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/monomorphization/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl AstPrinter {
write!(f, "]")
}
super::ast::Literal::Integer(x, typ, _) => {
if self.show_type_of_int_literal {
if self.show_type_of_int_literal && *typ != Type::Field {
write!(f, "{x}_{typ}")
} else {
x.fmt(f)
Expand Down
1 change: 0 additions & 1 deletion tooling/ast_fuzzer/fuzz/src/targets/acir_vs_brillig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub fn fuzz(u: &mut Unstructured) -> eyre::Result<()> {
// Overflows can be triggered easily, so in half the cases we avoid them,
// to make sure they don't mask other errors.
avoid_overflow: u.arbitrary()?,
avoid_large_int_literals: true,
..Default::default()
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ use noir_ast_fuzzer::rewrite::change_all_functions_into_unconstrained;

pub fn fuzz(u: &mut Unstructured) -> eyre::Result<()> {
let config = Config {
// Avoid using large integers in for loops that the frontend would reject.
avoid_large_int_literals: true,
// Also avoid negative integers, because the frontend rejects them for loops.
avoid_negative_int_literals: true,
// Avoid break/continue
avoid_loop_control: true,
// Has to only use expressions valid in comptime
comptime_friendly: true,
// Force brillig, to generate loops that the interpreter can do but ACIR cannot.
force_brillig: true,
// Allow overflows half the time.
avoid_overflow: u.arbitrary()?,
Comment thread
rkarabut marked this conversation as resolved.
// Slices need some parts of the stdlib that we can't just append to the source
// the way it is currently done to support prints, because they are low level extensions.
avoid_slices: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ pub fn fuzz(u: &mut Unstructured) -> eyre::Result<()> {
let config = Config {
// It's easy to overflow.
avoid_overflow: u.arbitrary()?,
// Avoid using large integers in for loops that the frontend would reject.
avoid_large_int_literals: true,
// Also avoid negative integers, because the frontend rejects them for loops.
avoid_negative_int_literals: true,
// Avoid break/continue
avoid_loop_control: true,
// Has to only use expressions valid in comptime
Expand Down
1 change: 0 additions & 1 deletion tooling/ast_fuzzer/fuzz/src/targets/min_vs_full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub fn fuzz(u: &mut Unstructured) -> eyre::Result<()> {
let config = Config {
// Overflows are easy to trigger.
avoid_overflow: u.arbitrary()?,
avoid_large_int_literals: true,
..Default::default()
};

Expand Down
6 changes: 1 addition & 5 deletions tooling/ast_fuzzer/fuzz/src/targets/orig_vs_morph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ use noirc_frontend::monomorphization::ast::{
pub fn fuzz(u: &mut Unstructured) -> eyre::Result<()> {
let rules = rules::all();
let max_rewrites = 10;
let config = Config {
avoid_overflow: u.arbitrary()?,
avoid_large_int_literals: true,
..Default::default()
};
let config = Config { avoid_overflow: u.arbitrary()?, ..Default::default() };
let inputs = CompareMorph::arb(
u,
config,
Expand Down
4 changes: 3 additions & 1 deletion tooling/ast_fuzzer/src/program/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@ impl std::fmt::Display for DisplayAstAsNoir<'_> {
printer.show_type_in_let = true;
// Most of the time it doesn't affect testing, except the comptime tests where
// we parse back the code. For that we use `DisplayAstAsNoirComptime`.
printer.show_type_of_int_literal = false;
// But printing ints with their type makes it much easier to replicate errors in integration tests,
// otherwise the frontend rejects negative or large numbers in many contexts.
printer.show_type_of_int_literal = true;
printer.print_program(self.0, f)
}
}
Expand Down
14 changes: 7 additions & 7 deletions tooling/ast_fuzzer/src/program/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,34 +203,34 @@ fn test_recursion_limit_rewrite() {
insta::assert_snapshot!(code, @r"
#[inline_always]
fn main() -> () {
let mut ctx_limit: u32 = 25;
let mut ctx_limit: u32 = 25_u32;
foo((&mut ctx_limit))
}
#[inline_always]
fn foo(ctx_limit: &mut u32) -> () {
if ((*ctx_limit) == 0) {
if ((*ctx_limit) == 0_u32) {
()
} else {
*ctx_limit = ((*ctx_limit) - 1);
*ctx_limit = ((*ctx_limit) - 1_u32);
unsafe { bar_proxy((*ctx_limit)) }
}
}
#[inline_always]
unconstrained fn bar(ctx_limit: &mut u32) -> () {
if ((*ctx_limit) == 0) {
if ((*ctx_limit) == 0_u32) {
()
} else {
*ctx_limit = ((*ctx_limit) - 1);
*ctx_limit = ((*ctx_limit) - 1_u32);
baz(ctx_limit);
qux(ctx_limit)
}
}
#[inline_always]
unconstrained fn baz(ctx_limit: &mut u32) -> () {
if ((*ctx_limit) == 0) {
if ((*ctx_limit) == 0_u32) {
()
} else {
*ctx_limit = ((*ctx_limit) - 1);
*ctx_limit = ((*ctx_limit) - 1_u32);
baz(ctx_limit)
}
}
Expand Down
Loading