Skip to content

Commit

Permalink
Add test to reproduce #2051
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Nov 7, 2024
1 parent 0614f95 commit ff9a098
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pilopt/tests/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,24 @@ 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 ff9a098

Please sign in to comment.