Closed fabiopakk closed 6 years ago
It seems that the implementation always tries to assign the results of the individual calls to a variable. That's a problem because that would not be possible in a pure context (e.g., inside a pure function). If all options for a call are pure functions, it would be better if the entire resulting translation was an expression, not a statement.
As an example, if you add a @Pure
annotation to one of the functions in the new test, Nagini reports an invalid program:
@Pure
def test_union_pure_functions(u: Union[E, F]) -> int:
Ensures(Result() == 5 or Result() == 7)
return u.some_int()
Good point, I'll handle this.
Code changed to support @Pure
as requested and also added the above example as test case. Please check if those modifications are compliant.
Branch renamed to fabiopakk_issue_117_pure_functions.
This is the pull request regarding issue 117. Additionally to the test case added from the issue report, other 3 test cases were added to fully exercise all possible inputs the modified function is expected to handle.
This change is