Skip to content

Commit 1d92cb7

Browse files
chore: add regression tests for PR #7570 from lambda interpreter test (#7638)
1 parent bdbdb63 commit 1d92cb7

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "regression_7570_nested"
3+
type = "bin"
4+
authors = [""]
5+
6+
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Regression test for bug that appears to be fixed by https://github.com/noir-lang/noir/pull/7570
2+
pub enum Foo {
3+
// at least three variants are required, i.e.
4+
// if e.g. only `A` and `B` are included, the bug goes away
5+
A,
6+
B,
7+
C,
8+
}
9+
10+
fn main() {
11+
// - the error occured with or without values in the array
12+
// - the error goes away if `x` is directly defined as e.g. `Foo::A`
13+
let arena: [Foo; 1] = [Foo::A];
14+
let x = arena[0];
15+
16+
// this needs to be in a loop with a positive bound for the error to occur
17+
for _ in 0..1 {
18+
match x {
19+
Foo::A => {
20+
// the error goes away if this match is removed
21+
match x {
22+
// the error goes away if we only match on Foo::A and/or '_'
23+
Foo::B => (),
24+
_ => (),
25+
}
26+
},
27+
_ => (),
28+
}
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "regression_7570_serial"
3+
type = "bin"
4+
authors = [""]
5+
6+
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Regression test for bug that appears to be fixed by https://github.com/noir-lang/noir/pull/7570
2+
pub enum Foo {
3+
// at least three variants are required, i.e.
4+
// if e.g. only `A` and `B` are included, the bug goes away
5+
A,
6+
B,
7+
C,
8+
}
9+
10+
fn main() {
11+
// - the error occurs with or without values in the array
12+
// - the error goes away if `x` is directly defined as e.g. `Foo::A`
13+
let arena: [Foo; 1] = [Foo::A];
14+
let x = arena[0];
15+
16+
match x {
17+
Foo::A => (),
18+
_ => (),
19+
}
20+
21+
// the error goes away if this match is removed
22+
match x {
23+
// the error goes away if we only match on Foo::A and/or '_'
24+
Foo::B => (),
25+
_ => (),
26+
}
27+
}

0 commit comments

Comments
 (0)