Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace regression_5202 with more manageably sized program #5345

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name = "regression_5202"
type = "bin"
authors = [""]
compiler_version = ">=0.30.0"
compiler_version = ">=0.29.0"

[dependencies]
fraction = { path = "fraction" }
41 changes: 41 additions & 0 deletions test_programs/execution_failure/regression_5202/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
trait ToField {
fn to_field(self) -> Field;
}

impl ToField for bool { fn to_field(self) -> Field { self as Field } }

unconstrained fn get_unconstrained_option() -> Option<u32> {
Option::some(13)
}

unconstrained fn should_i_assert() -> bool {
false
}

fn get_magical_boolean() -> bool {
let option = get_unconstrained_option();

let pre_assert = option.is_some().to_field();

if should_i_assert() {
// Note that `should_i_assert` is unconstrained, so Noir should not be able to infer
// any behavior from the contents of this block. In this case it is actually false, so the
// assertion below is not even executed (if it did it'd fail since the values are not equal).

assert_eq(option, Option::some(42)); /// <- this seems to be the trigger for the bug
}

// In my testing, the `option` value exhibits weird behavior from this point on, as if it had been mutated
let post_assert = option.is_some().to_field();

// The following expression should be true, but I can get it to evaluate to false depending on how I call it
pre_assert == post_assert
}

fn main() {
let magic = get_magical_boolean();

// One of these asserts should fail, but both pass.
TomAFrench marked this conversation as resolved.
Show resolved Hide resolved
assert_eq(magic, true);
assert_eq(magic, false);
}
21 changes: 0 additions & 21 deletions test_programs/execution_success/regression_5202/fraction/LICENSE

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions test_programs/execution_success/regression_5202/fraction/README.md

This file was deleted.

201 changes: 0 additions & 201 deletions test_programs/execution_success/regression_5202/fraction/src/lib.nr

This file was deleted.

23 changes: 0 additions & 23 deletions test_programs/execution_success/regression_5202/src/main.nr

This file was deleted.

Loading