-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Currently, if I try to use types like this:
#[proptest]
fn test_ra(#[strategy(0..=24)] h: u8, #[strategy(0..60)] m: u8, #[strategy(0..60)] s: u8) {I get an error like:
error[E0271]: type mismatch resolving `<RangeInclusive<i32> as proptest::strategy::Strategy>::Value == u8`
--> src\coords\astro.rs:279:27
|
279 | fn test_ra(#[strategy(0..=24)] h: u8, #[strategy(0..60)] m: u8, #[strategy(0..60)] s: u8) {
| ^ expected `u8`, found `i32`
|
note: required by a bound in `_strategy_of_h`
--> src\coords\astro.rs:279:39
|
278 | #[proptest]
| ----------- required by a bound in this
279 | fn test_ra(#[strategy(0..=24)] h: u8, #[strategy(0..60)] m: u8, #[strategy(0..60)] s: u8) {
| ^^ required by this bound in `_strategy_of_h`So, just like when using strategies directly in proptest!, I have to add suffixes to clarify which type I meant and then it works:
#[proptest]
fn test_ra(#[strategy(0..=24_u8)] h: u8, #[strategy(0..60_u8)] m: u8, #[strategy(0..60_u8)] s: u8) {However, test_strategy has more info that regular proptest! macro does - namely, it has access to explicit parameter types. Could it perhaps pass those through to corresponding generics to make inference work correctly without explicit suffixes?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels