Diagnostics · unsupported

unsupported[kind-mismatch]

Comparing values of different kinds, or ordering strings or booleans.

Numbers compare with any operator, and int and float mix. Strings and booleans compare only with == and !=, and only with their own kind.

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.region > "eu" [SOURCE:region]
  }
}

rejected unsupported[kind-mismatch] at 22:23 comparison type mismatch or ordering of nonnumbers

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.region != "eu" [SOURCE:region]
  }
}

accepted

See also: the specification.