Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Verse
Summary
While the official documentation states that using false? marks a function as failing, when actually executed, it throws an error saying, "This function returns a value of type int, but the function body’s result is an incompatible value of type logic.
Steps to Reproduce
Find(X:[]int, F(:int)<decides><transacts>:void)<decides>:int =
for (Y:X, F[Y]):
return Y
false?
Expected Result
It is treated as a failure by false.
Observed Result
The error message "This function returns a value of type int, but the function body’s result is an incompatible value of type logic.
Platform(s)
All
Additional Notes
The expression return Y will exit the function Find, returning the value contained in Y to the caller of the function. Note false? is used as a way to force the function to fail. In this case, this is sensible, since no value matching the predicate F was found in X. In the case of a function defined as returning void, an expression doesn’t need to be provided with the return expression.