Skip to content
Playground(another site)

bynk.property.restates_refinement

Error A property merely re-checks a refinement its type already guarantees.

A for all q: Quantity property draws only valid values of Quantity, so a body that just asserts the type's refinement, expect q > 0 over Int where Positive, cannot fail and proves nothing about your code. The compiler flags it. The check is narrow: it fires only when the body is that one expect, restating Positive or NonNegative over the bound value, so a near-copy may pass. Assert something about what your code does with the value, or delete the property.

Example

demo.bynk
type Quantity = Int where Positive
// tests/demo.test.bynk
for all q: Quantity { expect q > 0 } // ✗ the type already says this
for all q: Quantity { expect double(q) > q } // ✓ a claim about `double`

In the Book

See also