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

error type-mismatch

error Стандарт: [§3.5]

Тип выражения не соответствует ожидаемому.

What it means#

The type of an expression is not a subtype of the type the context expects (§3). The only implicit conversions are widening of a value to a union that contains its type (A to A | B, T to T?) and, for refined types, to the base type (§3.6). Numbers, distinct types and strings are never converted silently.

Example#

oxl✓ проверяется в CI
fn main() {
  let count: i32 = "five"      // <- type-mismatch
}
error
type-mismatch

How to fix#

oxl✓ проверяется в CI
fn main() {
  let count: i32 = 5
}

Change the expression or the annotation so that the types agree. Use an explicit conversion where one exists: x as T for numbers, Port.from(x) for refined types.

See also#

OxL 1.0.0-beta · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства