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

error operator-decl

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

Некорректное объявление оператора.

What it means#

A user-defined operator must satisfy §5.3: its symbol is built from the allowed characters and does not coincide with a built-in operator or delimiter, does not start with // or /*; the fixity is infixl N, infixr N, infix N with N between 1 and 12, or prefix; there are no postfix operators.

Example#

oxl✓ проверяется в CI
data Parser<T> { value: T }
impl Parser<T> { fn orElse(other: Parser<T>) -> Parser<T> => self }
operator <|> <T>(a: Parser<T>, b: Parser<T>) -> Parser<T>  infixl 15 => a.orElse(b)      // <- operator-decl (level must be 1-12)
error
operator-decl

How to fix#

oxl✓ проверяется в CI
data Parser<T> { value: T }
impl Parser<T> { fn orElse(other: Parser<T>) -> Parser<T> => self }
operator <|> <T>(a: Parser<T>, b: Parser<T>) -> Parser<T>  infixl 3 => a.orElse(b)

Choose a free symbol and a level between 1 and 12 from the table in §5.2.

See also#

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