bynk.val.literal_violates
Error A pinned Val[T] value violates the type's refinement.
A pinned Val[T](…) is checked against the refinement of T at compile time, and this literal breaks it, so the test would build a value the type does not allow. Pin a value that satisfies the refinement, or drop the pin and let Val[T] choose one. To test that an invalid value is refused, call T.of(…) and expect an Err.
Example
type Age = Int where InRange(0, 150)
// tests/ages.test.bynklet a = Val[Age](200) // ✗ 200 is outside InRange(0, 150)let a = Val[Age](20) // ✓ inside itIn the Book
- Testing › Val[T] — value fabrication
- Testing › @example — a value for a pattern
- Testing
- Write tests, stub collaborators, and pin a `Val[T]`
See also
- The grammar rule it governs:
val_expr. - Every code in its category, Value fabrication, on the diagnostic index.
bynk explain bynk.val.literal_violatesshows the same from the installed toolchain, without a network.