ErrorsProject layout and modules · rule
library.similar_exists
A library function already does the same.
Area 1, Project layout and modules; declinable; the next step is usually the agent's.
A declinable error: call the library function, or decline with a reason
when the two differ on purpose (Declining a judgement call).
A function is like a library function
when its parameter types, result, fails list and body are the same once
each parameter and variable is renamed by its position: a copy, however it
is formatted or named. Of two alike library functions, the later one in
file order is reported.
type Stock = Int { min: 0}library rounding { /// The amount, capped at a thousand. function capped(amount: Stock) -> Stock { if (amount > Stock(1000)) { return Stock(1000) } return amount }}function cap_total(total: Stock) -> Stock { if (total > Stock(1000)) { return Stock(1000) } return total}
error A similar library function exists: rounding.capped
--> main.jadpo:15:10
|15 | function cap_total(total: Stock) -> Stock { | ^^^^^^^^^ same as `rounding.capped`
- reason
cap_totaltakes the same parameters, gives the same result and has the same body asrounding.cappedinmain.jadpo, apart from the names of its variables.- next
- Call
rounding.cappedinstead, and removecap_total, or writedecline library.similar_exists: "<why>"above it if this is deliberate (agent) - rule
- library.
similar_ exists - help
- https://jadpo.
dev/docs/errors/library. similar_ exists
Markdown for agents: /docs/errors/library.similar_exists.md.Built from Jadpo main at aee2e8f.