Closed nickbattle closed 3 years ago
This was caused by the convertTo for function values, which currently intercepts the conversion in order to restrict the dom/range of the value to match the converted type. That is the right thing to do, but it then failed to check for invariance as well. The fix is to check for conversion to an invariant type and apply the invariant check to the converted value.
Fix now available in ncb/development.
If a named type is declared with an invariant, and the base type is a function, the invariant is not checked when function values are converted to that type. For example:
Both of the test functions currently return a T value, but test1 should raise an invariant violation.