Diagnostics · unsupported
unsupported[nonnumeric-comparison]
A string or boolean comparison not written as Entity.field op literal.
The fact comes first and the literal second. Two string facts cannot be compared: pass their relation as a boolean fact (see Patterns).
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 "eu" == Request.region [SOURCE:region]
}
}rejected unsupported[nonnumeric-comparison] at 22:23 nonnumeric comparisons require a field and literal
Fix
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 Request.region == "eu" [SOURCE:region]
}
}accepted
See also: the specification.