On this page
B1007: unit name does not match its file name
Catalog status: active. Default severity: warning. Stable name: unit-file-mismatch. Family: Names and declarations.
Verada (like GNAT) finds a unit by its file name: Ada.Text_IO's specification is in ada-text_io.vads and its body in ada-text_io.vadb. A file given on the command line whose unit has another name can still be checked, but other units will not find it. This is a warning.
Example (Vada)
main.vadb containing procedure Hello is ....
Example (Varc)
main.va containing fn hello() { ... }.
Example (Vibe)
A module file named Untitled-2.vb containing a constant or function. Vibe takes its module name from the filename, so there is no module declaration in the source to rename. Untitled-2 cannot be used in an import; changing only its case does not fix the hyphen. A name such as MixedCase.vb also differs from the lowercase filename used by unit lookup.
What to do (Vada)
Rename the file to the name in the message (hello.vadb).
What to do (Varc)
Rename the file to the name in the message (hello.va).
What to do (Vibe)
Follow the suggested importable lowercase filename, for example untitled_2.vb. Use letters, digits and underscores, starting with a letter or underscore, and avoid keywords. Update existing imports if the module name changes. The IDE’s Fix filename… quick-fix previews the compiler-selected name and any affected imports before applying them. Save named source/configuration buffers first; the fix never saves your unsaved edits. It preserves Vibe import bindings with aliases where necessary. Filename-only repairs for Vada, Varc and explicitly named programs leave the declared identity intact. File Undo/Redo reverses the rename and import edits together. A collision, stale source or ambiguous rewrite is refused with an explanation. General Rename… remains a filesystem operation; use this quick-fix to repair B1007. An explicitly named main program still follows the normal unit-name/file-name convention.
The quick-fix currently works within the captured workspace/project sources. Imports outside that scope need a separate review. Identity-changing repairs with child-unit imports, cross-syntax qualified references or ambiguous bindings are refused rather than guessed; ordinary Vada/Varc filename corrections and case-only Vibe corrections remain supported.
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See names and declarations, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.