Commit 1d92cb7 1 parent bdbdb63 commit 1d92cb7 Copy full SHA for 1d92cb7
File tree 4 files changed +69
-0
lines changed
test_programs/compile_success_empty
4 files changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " regression_7570_nested"
3
+ type = " bin"
4
+ authors = [" " ]
5
+
6
+ [dependencies ]
Original file line number Diff line number Diff line change
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 number Diff line number Diff line change
1
+ [package ]
2
+ name = " regression_7570_serial"
3
+ type = " bin"
4
+ authors = [" " ]
5
+
6
+ [dependencies ]
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments