OxL Reference

error missing-field

error Standard: [§4.3]

What it means#

A literal T{ ... } MUST give a value to every field that has no default value (§4.3). Fields with defaults, and fields taken from a base with ..base, may be omitted.

Example#

oxl✓ checked in CI
data User {
  id: u64
  name: str
}

fn main() {
  let u = User{ id: 1 }      // <- missing-field (name)
}
error
missing-field

How to fix#

oxl✓ checked in CI
data User {
  id: u64
  name: str
}

fn main() {
  let u = User{ id: 1, name: "Ann" }
}

Provide the missing field, give it a default in the declaration (name: str = ""), or spread from an existing value with ..base.

See also#

OxL 1.0.0-beta · Documentation version 1.0.0-beta© OxwaldLink · generated from the Standard, the std sources and the guides