Skip to content
Playground(another site)

bynk.resolve.duplicate_field_init

Error A record construction initialises a field twice.

A record literal gives each field one value. A field set twice leaves it unclear which value is meant, and is nearly always a pasted line or a misspelt name for the field that was meant. Remove the repeat, or correct the name. A field declared twice in the type is bynk.resolve.duplicate_field; a field left out of the literal is bynk.resolve.missing_field.

Example

type Point = { x: Int, y: Int }
fn origin() -> Point { Point { x: 0, y: 0, y: 1 } } // ✗ `y` set twice
fn origin() -> Point { Point { x: 0, y: 0 } } // ✓ each field once

In the Book

See also