Diagnostics · unsupported
unsupported[call-or-arithmetic]
A function call, or a subtraction such as cap -1, in a condition.
v1 has no functions. cap -1 (a minus directly before a digit, after an operand) parses as a subtraction and is refused here; with a space, cap - 1, the bounds scan refuses it as unsupported[arithmetic]. Pass computed values as facts.
Example
compileSourceCONTRACT Claim {
ENFORCEMENT_MODE: enforced
CONTEXT {
ENTITIES Request {
count: int
region: string
ready: bool
ratio: float
}
CONSTANTS {
zero: int == 0 [SOURCE:POLICY]
cap: int == 25 [SOURCE:POLICY]
}
}
TRIGGER {
grant()
}
GUARANTEE {
ENSURE grant() WHEN Request.ready == true [SOURCE:must_be_ready]
}
PROHIBITION {
FORBID grant WHEN len(Request.region) > 2 [SOURCE:region]
}
}rejected unsupported[call-or-arithmetic] at 22:23 calls, lists and arithmetic are unsupported
Fix
compileSourceCONTRACT Claim {
ENFORCEMENT_MODE: enforced
CONTEXT {
ENTITIES Request {
count: int
region: string
region_length: int
ready: bool
ratio: float
}
CONSTANTS {
zero: int == 0 [SOURCE:POLICY]
cap: int == 25 [SOURCE:POLICY]
}
}
TRIGGER {
grant()
}
GUARANTEE {
ENSURE grant() WHEN Request.ready == true [SOURCE:must_be_ready]
}
PROHIBITION {
FORBID grant WHEN Request.region_length > 2 [SOURCE:region]
}
}accepted
See also: the docs.