ErrorsValues and types · rule
type.rule_outside_object
Rule is written outside an object type.
Area 2, Values and types; not declinable; the next step is usually the agent's.
Only an Object, Input or Output names rules across its fields: a
refinement's rules are its constraints, and an entity's records are made
by writes, which have their own conditions (area 6):
type Nights = Int { min: 1 rule short_stay: Nights <= 14}
error Only an Object, Input or Output names rules across its fields
--> main.jadpo:3:5
|3 | rule short_stay: Nights <= 14 | ^^^^^^^^^^^^^^^ in a type built on `Int`
- reason
Nights, built onInt, can't hold a rule: a rule relates the fields of one object, so it is written in the block of anObject,InputorOutput, and checked whenever a value of it is made.- next
- Move the rule into the object type whose fields it reads, or remove it (agent)
- rule
- type.
rule_ outside_ object - help
- https://jadpo.
dev/docs/errors/type. rule_ outside_ object
Markdown for agents: /docs/errors/type.rule_outside_object.md.Built from Jadpo main at aee2e8f.