diff --git a/Cargo.lock b/Cargo.lock index e95f7831278..73be34e3ff3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3568,7 +3568,6 @@ dependencies = [ "num-traits", "petgraph", "proptest", - "proptest-derive", "rayon", "serde", "serde_json", diff --git a/compiler/noirc_evaluator/Cargo.toml b/compiler/noirc_evaluator/Cargo.toml index 0f558ce8b40..0e11175d0f7 100644 --- a/compiler/noirc_evaluator/Cargo.toml +++ b/compiler/noirc_evaluator/Cargo.toml @@ -35,7 +35,6 @@ petgraph.workspace = true [dev-dependencies] proptest.workspace = true -proptest-derive.workspace = true similar-asserts.workspace = true tracing-test = "0.2.5" num-traits.workspace = true diff --git a/compiler/noirc_evaluator/src/ssa/ir/types.rs b/compiler/noirc_evaluator/src/ssa/ir/types.rs index ed9451f78fc..ee1a9d36205 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/types.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/types.rs @@ -15,7 +15,6 @@ use crate::ssa::ssa_gen::SSA_WORD_SIZE; /// Fields do not have a notion of ordering, so this distinction /// is reasonable. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Serialize, Deserialize)] -#[cfg_attr(test, derive(proptest_derive::Arbitrary))] pub enum NumericType { Signed { bit_size: u32 }, Unsigned { bit_size: u32 }, @@ -101,6 +100,32 @@ impl NumericType { } } +#[cfg(test)] +mod props { + use proptest::{ + prelude::{Arbitrary, BoxedStrategy, Just, Strategy as _}, + prop_oneof, + }; + + use super::NumericType; + + impl Arbitrary for NumericType { + type Parameters = (); + type Strategy = BoxedStrategy; + + fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy { + let signed = prop_oneof!(Just(8), Just(16), Just(32), Just(64)); + let unsigned = prop_oneof!(Just(1), Just(8), Just(16), Just(32), Just(64), Just(128)); + prop_oneof![ + signed.prop_map(|bit_size| NumericType::Signed { bit_size }), + unsigned.prop_map(|bit_size| NumericType::Unsigned { bit_size }), + Just(NumericType::NativeField), + ] + .boxed() + } + } +} + /// All types representable in the IR. #[derive(Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Serialize, Deserialize)] pub(crate) enum Type {