Skip to content
Playground(another site)

bynk.types.field_value_mismatch

Error A record field was given a value of the wrong type.

A record literal checks each field against the type the declaration gives it, with no implicit conversion, so y: "0" for an Int field is refused where it is written. Give the field a value of its declared type, or convert it first. A field the type lacks is bynk.resolve.unknown_field, and one left out is bynk.resolve.missing_field.

Example

type Point = { x: Int, y: Int }
fn origin() -> Point {
Point { x: 0, y: "0" } // ✗ `y` is an `Int`
}
fn origin() -> Point {
Point { x: 0, y: 0 } // ✓
}

In the Book

See also