ErrorsProject layout and modules · rule
layout.unused_declaration
Shared declaration is not used.
Area 1, Project layout and modules; not declinable; the next step is usually the agent's.
type DueWindow = Int { min: 1}
error DueWindow isn't used
--> domains/planning/types/due_window.jadpo:1:6
|1 | type DueWindow = Int { | ^^^^^^^^^ nothing uses this
- reason
- A shared type exists to be used by several files; one that nothing uses is dead code. Tests don't count as users.
- next
- Use
DueWindow, or remove it if nothing will (agent) - rule
- layout.
unused_ declaration - help
- https://jadpo.
dev/docs/errors/layout. unused_ declaration
Beside a file's primary declaration, a supporting type or helper is there for it: the primary uses it, directly or through another supporting declaration it uses. One only the file's tests use is dead code too:
type Shelf = Int { min: -2 max: 2}type OvenTemperature = Int { min: 0 max: 300}function top_shelf() -> Shelf { return 2}/// The temperature for a bake on `shelf`: a high shelf runs hot.action set_oven(shelf: Shelf) -> OvenTemperature { if (shelf > 0) { return 190 } return 200}
error top_shelf isn't used by set_oven
--> domains/kitchen/actions/set_oven.jadpo:11:10
|11 | function top_shelf() -> Shelf { | ^^^^^^^^^ `set_oven` doesn't use this
- reason
- Everything in a file besides the declaration it is named after is there for that declaration, used by it directly or through one another; anything else is dead code. Tests don't count as users.
- next
- Use
top_shelfinset_oven, or remove it if nothing will (agent) - rule
- layout.
unused_ declaration - help
- https://jadpo.
dev/docs/errors/layout. unused_ declaration
The file's test calls top_shelf, which doesn't count:
test "the top shelf is turned down" { assert set_oven(top_shelf()) == 190}
A type written ahead of what will use it is refused the same way. Write it and its first user as one change, then check:
type DueWindow = Int { min: 1}
use planning/types { DueWindow }/// The window a reminder waits, as it was asked for.action next_due(days: DueWindow) -> DueWindow { return days}
Markdown for agents: /docs/errors/layout.unused_declaration.md.Built from Jadpo main at aee2e8f.