bynk.types.example_on_named_field
Error An @example on a field whose type is a named type (it belongs on the named type).
On a record field, @example pins the field's own value, which exists only where the field has a base type. A field of a named type takes its value from that type, so an example on the field would have no effect and is refused. Put the @example on the named type's declaration, where Val reads it.
Example
type Code = String where Matches("[A-Z]{3}")type Ticket = { code: Code where Matches("[A-Z]+") @example("ABC") } // ✗ `Code` is a named type
type Code = String where Matches("[A-Z]{3}") @example("ABC") // ✓ pin it on the typetype Ticket = { code: Code }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_on_named_fieldshows the same from the installed toolchain, without a network.