Logic · rule
type.arithmetic_operand
Arithmetic operand has the wrong type.
Area 3, Logic; not declinable; the next step is usually the agent's.
+ and - need the same named type on both sides; multiplying a price by a quantity is meaningful, adding them is not:
type Stock = Int { min: 0}type Quantity = Int { min: 1}function wrong_total(per_pack: Stock, packs: Quantity) -> Stock { return Stock(per_pack + packs)}
error: `Stock` and `Quantity` can't be added --> main.jadpo:10:18 |10 | return Stock(per_pack + packs) | ^^^^^^^^^^^^^^^^ different types reason: `+` and `-` need the same named type on both sides, or a literal, because `Stock` and `Quantity` are different units; `*` and `%` may mix types. next: Use two values of the same type (agent) rule: type.arithmetic_operand help: https://jadpo.dev/docs/errors/type.arithmetic_operandcheck failed: 1 error, 1 file
Markdown for agents: /docs/errors/type.arithmetic_operand.md.Built from Jadpo main at a707efb.