Skip to content

Commit

Permalink
Add test back
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Nov 7, 2024
1 parent b82352d commit acb3d21
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pilopt/tests/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,23 @@ fn enum_ref_by_trait() {
let optimized = optimize(analyze_string::<GoldilocksField>(input).unwrap()).to_string();
assert_eq!(optimized, expectation);
}

#[test]
#[should_panic = "Symbol not found: N::x[0]"]
fn handle_array_references_in_prover_functions() {
// Reproduces https://github.com/powdr-labs/powdr/issues/2051
let input = r#"namespace N(8);
col witness x[1];
// non-trivial constraint so that `x[0]` does not get removed.
x[0]' = x[0] + 1;
{
let intermediate = x[0] + 1;
query |i| {
// No-op, but references `x[0]`.
let _ = intermediate;
}
};
"#;
optimize(analyze_string::<GoldilocksField>(input).unwrap()).to_string();
}

0 comments on commit acb3d21

Please sign in to comment.