Skip to content
Playground(another site)

bynk.resolve.missing_field

Error A record construction omits a required field.

A record must be constructed with every field that has no default. There is no partial construction: a value of a record type is only valid once all its fields are present, so a downstream reader never has to wonder whether a field was set. Omitting a required field is therefore an error, not a fill-in-later. A field may be left out only when its declaration gives it a default, field: T = expr.

Example

type User = { name: String, age: Int }
User { name: "Ada" } // ✗ missing `age`
User { name: "Ada", age: 36 } // ✓ every field present

In the Book

See also