DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B0401: Python form that Vibe does not take

Catalog status: active. Default severity: error. Stable name: vibe-excluded. Family: Syntax and source text.

Vibe takes the typed subset of Python that has Verada's meaning. This form is outside it: it has no translation Verada can check, prove and run. The message says what to write instead. That Python's own parser accepts a form does not make it one Vibe takes; the Vibe reference lists the forms it does.

Example (Vibe)

from dataclasses import dataclass


@dataclass
class Counter:
    n: int


counter = Counter(n=0)
error[B0401]: `counter` and `Counter` differ only in case, which Ada (and so Verada) does not tell apart: rename one, as `counter_obj` or `CounterType`

What to do

Follow the message: each form has a direct rewrite. Two names that differ only in case get names that differ otherwise. An index that counts from the end, a[-1], becomes a[len(a) - 1] (a slice's bounds may be negative, as in Python). A comprehension over range with a step becomes one over range without a step that computes each value from the loop variable: [2 * k for k in range((n + 1) // 2)].

Regression source and further reading

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

See syntax and source text, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.