Diagnostics · unsupported

unsupported[arithmetic]

+ * / ^, or a - that is not directly followed by a digit.

Contracts compare facts; they do not compute. Have the application compute derived values and pass them as facts, or restate the comparison: for integers, count + 1 > cap is count >= cap.

Example

Through compileSource
CONTRACT 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.count + 1 > cap [SOURCE:over_cap]
  }
}

rejected unsupported[arithmetic] at 22:37 arithmetic is refused before recursive parsing

Fix

Through compileSource
CONTRACT 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.count >= cap [SOURCE:over_cap]
  }
}

accepted

See also: the docs.