bynk.contract.restated_by_test
Error A case/property merely restates a contract clause already declared at the function; the test is redundant.
A function's ensures is checked at every call, in production and in every test that reaches it. A test that calls the function and expects the same predicate adds nothing and has to be kept in step with the contract. The compiler flags the repeat. The check is narrow: it fires only on a syntactic restatement over the same arguments. Delete the test, or keep a case only for a specific value a reader should see, such as expect discount(100, 10) == 90.
Example
fn discount(p: Int, pct: Int) -> Int ensures never_above: result <= p { … }
// tests/c.test.bynklet r = discount(100, 10)expect r <= 100 // ✗ repeats `never_above`expect r == 90 // ✓ a specific witnessed valueIn the Book
See also
- Every code in its category, Contracts, on the diagnostic index.
bynk explain bynk.contract.restated_by_testshows the same from the installed toolchain, without a network.