Skip to content
Playground(another site)

bynk.types.variant_missing_payload

Error A variant requiring a payload was used without one.

A variant with a payload is built by calling it, with its payload as arguments. Written bare, Circle is not a value, since nothing fills radius; only a variant with no payload can stand alone. Call it with one argument per field, as Circle(10). The qualified form Shape.Circle is refused in the same way. A call with the wrong number of arguments is bynk.types.variant_arity.

Example

type Shape =
| Circle(radius: Int)
| Dot
fn make() -> Shape {
Circle // ✗ `Circle` carries a payload
}
fn make() -> Shape {
Circle(10) // ✓
}

In the Book

See also

  • Every code in its category, Type checking, on the diagnostic index.
  • bynk explain bynk.types.variant_missing_payload shows the same from the installed toolchain, without a network.