bynk.types.example_violates
Error An @example does not satisfy its refinement's predicates.
@example is the value Val uses for a type it cannot fabricate, so it must be a valid one. The compiler checks it where the type is declared, against every predicate of the refinement, whether or not a test uses it; an example that fails one would give tests a value the type refuses. Write an example that satisfies the whole refinement.
Example
type Code = String where Matches("[A-Z]{3}") @example("abc") // ✗ lower case
type Code = String where Matches("[A-Z]{3}") @example("ABC") // ✓In the Book
See also
- The grammar rule it governs:
refinement. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.example_violatesshows the same from the installed toolchain, without a network.