OxL Reference

error comptime-error

error Standard: [§15.1]

What it means#

Code that runs at compile time (const, comptime blocks and functions) failed: a panic, a division by zero, an overflow or a failing contract (§15.1). The error is reported at the compile-time expression. Compile-time code is deterministic, so it fails on every build.

Example#

oxl✓ checked in CI
data P {
  x: i32
}

fn main() io {
  print(reflect(P).colour)      // <- comptime-error (P has no member `colour`)
}
error
comptime-error

How to fix#

oxl✓ checked in CI
data P {
  x: i32
}

fn main() io {
  print(reflect(P).name)
}

Fix the computation. For a value that is only known at run time, use let or config instead of const.

See also#

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