Error codes › word-operator

Error codes

word-operator

error hint Style: how the model reads (archec vet)

What it means#

A condition written with the words and, or, not in the action language (a body, a guard, a transition’s action, a ui expression, a test line that is the action language): it writes &&, ||, !. An error from edition 1.2, with its quick fix; before it, computed only when asked for: archec fix --only word-operator rewrites them, and keeps a word where the text would not read the same. archec fmt --edition 1.2 --write rewrites them and sets the edition. Not in strings, comments, Python, sentences or check conditions; a test line that is valid Python too (expect a and b) stays as written.

Example#

The action language writes a condition with &&, || and !; the words and, or and not are still read, as other spellings, in every edition before 1.2 — and nothing is said of them unless asked for, so an existing model stays clean. archec fix --only word-operator --write rewrites them. It reads a fn's body (fenced or not), on-enter, on-exit and a handler. It reads a transition's guard and action when the simulator reads them as the action language. It reads a derived value, a parameter's default, a ui's expressions and on bodies. And it reads a test line that is the action language (a ```arche one, or one with a form only it has: expect sent(GO) >= 1 and not c.busy). A test line valid in Python too (expect c.a and not c.b) stays as written. Python and TypeScript bodies, strings, comments, sentences, check conditions and formal properties are not touched. Each edit is kept only where the text, read again, gives the same tree. From edition 1.2 each word is an error with this fix, in the project's own files (not a library's); archec fmt --edition 1.2 --write rewrites them and sets the edition.

How to fix it#

The message says what is wrong and where, and often what was meant (Did you mean …?). Change the model so that what this page describes no longer holds, then check again: archec check main.arche.

A style finding: archec vet reports it, archec check does not; archec fmt --write writes the layout ones.

archec check --beginner says the most common messages in plain words, with the names that exist.

The automatic fix#

and, or, not of the action language written &&, \|\|, ! (not(x) → !(x), not x → !x): bodies, guards and actions the simulator reads as the action language, derived values, parameter defaults, ui expressions, test lines that are the action language. Each edit kept only where the text, read again, gives the same tree; else the finding says why. An error with this fix from edition 1.2; before it, computed only by archec fix --only word-operator.

In VS Code, the light bulb on the line (Quick Fix) applies it. In the terminal, archec fix main.arche applies it with the other fixes, then checks again.

In the terminal#

archec explain word-operator prints this explanation; archec explain style lists the codes of its area.