Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise an error when postconditions of pure functions contain old() expressions #1474

Merged
merged 7 commits into from
Dec 7, 2023

Conversation

zgrannan
Copy link
Collaborator

It doesn't make sense to have old() expressions in postconditions of pure functions (since they don't modify the heap). Also, the PureFunctionEncoder can't handle them (resulting in internal/consistency errors).

This PR makes it an error to include old() in postconditions of pure functions. Resolves #1306

This PR also includes support for StubFunctionEncoder to handle bodyless functions (e.g. those from #[extern_spec])

@zgrannan zgrannan marked this pull request as draft November 28, 2023 05:34
@zgrannan zgrannan marked this pull request as ready for review November 28, 2023 20:56
@zgrannan zgrannan merged commit 202ca0e into viperproject:master Dec 7, 2023
19 checks passed
@zgrannan zgrannan deleted the zgrannan/old-in-pure-error branch December 7, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consistency error from marking Option::unwrap as #[pure]
1 participant