B2030: an assertion level declared or used inconsistently
Catalog status: active. Default severity: error. Stable name: assertion-level. Family: Types and constraints.
An assertion level groups ghost entities and assertions so that a build can enable or disable them together. pragma Assertion_Level (Gold, Depends => Silver), a configuration pragma before a unit, declares one; Runtime and Static always exist. Ghost => Gold puts a ghost entity at a level, and a contract or an assertion can give each of its parts one: Pre => (Silver => A, Gold => B), pragma Assert (Gold => C).
Verada proves every level. This error reports what would make a build fail once a level is disabled: a level declared again with other dependencies, a level that depends on one not declared before it, a Ghost => that names no level, and a ghost entity of a level referenced from an assertion (or the contract of a ghost entity) whose level does not depend on it.
Example (Vada)
pragma Assertion_Level (Silver);
pragma Assertion_Level (Gold, Depends => Silver);
...
function Is_Tiny (X : Integer) return Boolean is (X in 0 .. 10) with Ghost => Gold;
...
pragma Assert (Silver => Is_Tiny (V));What to do (Vada)
Reference an entity only at its level or a level that depends on it:
pragma Assert (Gold => Is_Tiny (V));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.