B8005: variable never changes after its initialisation
Catalog status: active. Default severity: warning. Stable name: never-changed. Family: Warnings and assumptions.
A local variable is declared with a value and nothing changes it afterwards: no assignment, no out or in out parameter, no renaming that could write it. Declaring it a constant says so to the reader, keeps it from being changed by mistake later, and lets the prover treat it as a fixed value. The fix-it rewrites the declaration.
Example (Vada)
procedure Main is
Limit : Integer := 10;
begin
Ada.Text_IO.Put_Line (Integer'Image (Limit));
end Main;Declare it constant: Limit : constant Integer := 10;.
Example (Varc)
fn main() {
var limit: Integer = 10;
Ada.Text_IO.Put_Line(Integer::Image(limit));
}
Use let: let limit: Integer = 10;.
What to do
Make it a constant, or change it where you meant to.
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See warnings and assumptions, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.