bynk.contract.not_bool
Error A contract predicate does not have type Bool.
A requires or ensures clause is a claim the function can meet or break, so its predicate must be a Bool. A value of another type, such as an Int, claims nothing that could fail. Write a comparison or another Bool expression over the parameters (and result, in an ensures).
Example
fn inc(x: Int) -> Int ensures bigger: result + 1 // ✗ an `Int`, not a `Bool`
fn inc(x: Int) -> Int ensures bigger: result > x // ✓In the Book
See also
- Every code in its category, Contracts, on the diagnostic index.
bynk explain bynk.contract.not_boolshows the same from the installed toolchain, without a network.