ErrorsProject layout and modules · rule
import.unneeded
A file imports a name it already sees without a use line, such as a built-in or something its test subject declares.
Area 1, Project layout and modules; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
A use line tells a reader where a name lives. Some names need no such
line, because where they live is already plain: built-in types and the
standard library, what the file declares itself, what a test file's
subject declares, and the file's own domain. An import of one of them
says nothing, and suggests the name lives somewhere it doesn't.
What it looks like
domains/menu/actions/stock_item.jadpo:
use shared/types { Stock }/// A loaf's stock before any choices.function loaf_stock() -> Stock { return 250}action stock_item() -> Stock { return loaf_stock()}
domains/menu/actions/stock_item.test.jadpo, its test file:
use menu/actions { loaf_stock }test "a loaf has 250 in stock" { assert loaf_stock() == 250}
error loaf_stock is declared in this test's subject
--> domains/menu/actions/stock_item.test.jadpo:1:20
|1 | use menu/actions { loaf_stock } | ^^^^^^^^^^ needs no import
- reason
- A test file sees everything its subject declares without importing it, and
loaf_stockis instock_item.jadpo. - next
- Remove this line (agent)
- rule
- import.
unneeded - help
- https://jadpo.
dev/docs/errors/import. unneeded
(agent) at the end of the next: line means your coding agent can make
the fix itself.
How to fix it
If the name is one the file already sees, remove the line.
domains/menu/actions/stock_item.test.jadpo becomes:
test "a loaf has 250 in stock" { assert loaf_stock() == 250}
The test calls loaf_stock directly, as it already could. Anything else
it uses still comes in on a use line.
Related
Markdown for agents: /docs/errors/import.unneeded.md.Built from Jadpo main at aee2e8f.