DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
B3014: ghost code modifies state that is not ghost
Catalog status: active. Default severity: error. Stable name: ghost-writes-state. Family: Flow and effects.
Ghost code is erased from the generated program, so it must not change anything the program can observe: a ghost subprogram may write only ghost globals, and a ghost procedure may be given only ghost variables to change.
Example (Vada)
procedure Audit with Ghost, Global => (In_Out => Count); -- Count is not ghostExample (Varc)
pub ghost fn audit() @Global(In_Out => count) { // count is not ghost
What to do
Make the state it changes ghost too, or make the subprogram not ghost.
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See flow and effects, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.