ErrorsProject layout and modules · rule
layout.promotion_required
Declaration is used beyond the file that holds it.
Area 1, Project layout and modules; not declinable; the next step is usually the agent's.
use planning/actions { SnoozeDays }action postpone_all(days: SnoozeDays) -> Unit {}
type SnoozeDays = Int { min: 1 max: 30}action snooze_todo(days: SnoozeDays) -> Unit {}
error SnoozeDays is used beyond this file
--> domains/planning/actions/snooze_todo.jadpo:1:6
|1 | type SnoozeDays = Int { | ^^^^^^^^^^ used by another file
- reason
- A type used by one file lives in it; once another file uses it, it moves to a file of its own in
domains/planning/types/.domains/planning/actions/postpone_all.jadpouses it too. - next
- Move
SnoozeDaystodomains/planning/types/snooze_days.jadpo, or runjadpo fmt --layout, which moves it and updates the imports (agent) - rule
- layout.
promotion_ required - help
- https://jadpo.
dev/docs/errors/layout. promotion_ required
Moving to the right folder is not enough: a second declaration in a file
moves to a file of its own once another file uses it, so every name a use
line brings in is <folder>/<name>.jadpo. The edit makes the move, and
jadpo fmt --layout makes it and updates the imports:
type DiscountCode = Text { max_length: 12}type Basket = Object { code: DiscountCode}
error DiscountCode is used beyond this file
--> domains/sales/types/basket.jadpo:1:6
|1 | type DiscountCode = Text { | ^^^^^^^^^^^^ used by another file
- reason
- A declaration another file uses has a file of its own named after it, so its
useline says where it is;DiscountCodeis inbasket.jadpo, named after another declaration, and moves todomains/sales/types/.domains/sales/actions/apply_code.jadpouses it too. - next
- Move
DiscountCodetodomains/sales/types/discount_code.jadpo, or runjadpo fmt --layout, which moves it and updates the imports (agent) - rule
- layout.
promotion_ required - help
- https://jadpo.
dev/docs/errors/layout. promotion_ required
use sales/types { Basket, DiscountCode }action apply_code(basket: Basket, code: DiscountCode) -> Unit {}
A move whose new file would carry another declaration's name too is left
for you: ListBooks's own file would be list_books.jadpo, action
list_books's name, which is naming.folded_collision. The error says to
rename the type first, and jadpo fmt --layout refuses the move until then:
use shop/actions { ListBooks }action browse_books(filter: ListBooks) -> Unit {}
type ListBooks = Input { page_size: PageSize { default: 25 }}action list_books(filter: ListBooks) -> Unit {}
error ListBooks is used beyond this file
--> domains/shop/actions/list_books.jadpo:1:6
|1 | type ListBooks = Input { | ^^^^^^^^^ used by another file
- reason
- A type used by one file lives in it; once another file uses it, it moves to a file of its own in
domains/shop/types/.domains/shop/actions/browse_books.jadpouses it too. Its own file would belist_books.jadpo, the file name oflist_books, an action indomains/shop/actions/list_books.jadpo. - next
- Rename
ListBooksfirst, so its file name differs fromlist_books's, then move it todomains/shop/types/(agent) - rule
- layout.
promotion_ required - help
- https://jadpo.
dev/docs/errors/layout. promotion_ required
Markdown for agents: /docs/errors/layout.promotion_required.md.Built from Jadpo main at aee2e8f.