Values and types · rule
type.invalid_literal
Literal breaks its type's rules.
Area 2, Values and types; not declinable; the next step is usually the agent's.
A literal takes the type it goes into and is checked against its rules while compiling, whether it is returned, assigned, passed or written as Quantity(0):
type Quantity = Int { min: 1 max: 1000}function starting_quantity() -> Quantity { return 0}
error: `0` isn't a valid `Quantity` --> main.jadpo:7:12 |7 | return 0 | ^ breaks `min: 1` reason: `Quantity` declares `min: 1`, and the value is below 1. A literal is checked against every rule while compiling. next: Use a value that `Quantity` allows (agent) rule: type.invalid_literal help: https://jadpo.dev/docs/errors/type.invalid_literalcheck failed: 1 error, 1 file
Markdown for agents: /docs/errors/type.invalid_literal.md.Built from Jadpo main at a707efb.