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: add regression tests for PR #7570 from lambda interpreter test #7638

Merged
merged 3 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -0,0 +1,6 @@
[package]
name = "regression_7570_nested"
type = "bin"
authors = [""]

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Regression test for bug that appears to be fixed by https://github.com/noir-lang/noir/pull/7570
pub enum Foo {
// at least three variants are required, i.e.
// if e.g. only `A` and `B` are included, the bug goes away
A,
B,
C,
}

fn main() {
// - the error occured with or without values in the array
// - the error goes away if `x` is directly defined as e.g. `Foo::A`
let arena: [Foo; 1] = [Foo::A];
let x = arena[0];

// this needs to be in a loop with a positive bound for the error to occur
for _ in 0..1 {
match x {
Foo::A => {
// the error goes away if this match is removed
match x {
// the error goes away if we only match on Foo::A and/or '_'
Foo::B => (),
_ => (),
}
},
_ => (),
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "regression_7570_serial"
type = "bin"
authors = [""]

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Regression test for bug that appears to be fixed by https://github.com/noir-lang/noir/pull/7570
pub enum Foo {
// at least three variants are required, i.e.
// if e.g. only `A` and `B` are included, the bug goes away
A,
B,
C,
}

fn main() {
// - the error occurs with or without values in the array
// - the error goes away if `x` is directly defined as e.g. `Foo::A`
let arena: [Foo; 1] = [Foo::A];
let x = arena[0];

match x {
Foo::A => (),
_ => (),
}

// the error goes away if this match is removed
match x {
// the error goes away if we only match on Foo::A and/or '_'
Foo::B => (),
_ => (),
}
}
Loading