Skip to content
Playground(another site)

bynk.resolve.reserved_payload_field

Error A sum variant declares a payload field named kind, the variant's wire discriminant.

A sum value is encoded as a flat JSON object whose kind field holds the variant's name, so a payload field called kind would collide with that tag. Rename the field, for instance to category.

Example

type Shape = | Circle(kind: String, r: Int) | Square(side: Int) // ✗ `kind` is the variant tag
type Shape = | Circle(category: String, r: Int) | Square(side: Int) // ✓ any other name

In the Book

See also

  • The grammar rule it governs: sum_type.
  • Every code in its category, Resolution, on the diagnostic index.
  • bynk explain bynk.resolve.reserved_payload_field shows the same from the installed toolchain, without a network.