OxL Справочник OxL
РусскийEnglish

error comptime-error

error Стандарт: [§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✓ проверяется в 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✓ проверяется в 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 · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства