DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B2009: operator not defined for the type

Catalog status: active. Default severity: error. Stable name: no-operator. Family: Types and constraints.

The predefined operator does not exist for this type: arithmetic is for numeric types, and, or, xor and not for Boolean and modular types, & for one-dimensional arrays, < and friends for scalar types and one-dimensional arrays.

Example (Vada)

   X := Flag + 1;     --  Flag is a Boolean
   Flag := not X;     --  X is an Integer

Example (Varc)

    x = flag + 1;     // flag is a Boolean
    flag = !x;        // x is an Integer

What to do (Vada)

Use an operator of the type, convert, or declare the operator yourself (function "+" (L : Boolean; R : Integer) return Integer).

What to do (Varc)

Use an operator of the type, convert, or declare the operator yourself (fn operator+(l: Boolean, r: Integer) -> Integer).

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See types and constraints, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.