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

Check for out of scope variables. #175

Merged
merged 5 commits into from
Nov 9, 2023

Conversation

n-osborne
Copy link
Collaborator

Fixes #171

This PR proposes to check for out of scope variables (returned values when building next_state function) in the subst_term function.

It can be argued that subst_term is now doing a lot of different things, but the added feature does not add lot of complexity, I used an optional arguement so that the change is transparent for user that does not need the new feature, and writing another function implementing this check would necessitate the same traversal of the term type.

Non compiling code is not generated anymore, but if the next_state function has not been generated, the user stay unaware of the why.

I didn't fix this last problem in this PR because it may necessitate a larger reflexion on which errors we want to display and which errors we want to forget about.

@n-osborne n-osborne force-pushed the fix-out-of-scope branch 5 times, most recently from 0f6de4c to dd8d324 Compare November 8, 2023 11:37
@n-osborne n-osborne requested a review from shym November 8, 2023 13:26
Copy link
Contributor

@shym shym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good, thank you!
I only saw a “occurences” (instead of “occurrences”) :-)

I agree that we need to think a bit more about how to inform users about why the clause was not used to generate next_state without drowning them under useless warnings.

Returned values are out of scope in this function.
The error message will not be printed to the user as we forget about why
we counldn't use a term when looking for one suitable for `next_state`.
(See the use of `to_option` in `next_state_case`)
Fixes ocaml-gospel#171
Non compiling code is not generated anymore, but the user doesn't know
why `next_state` was not generated.
@n-osborne n-osborne merged commit 4707033 into ocaml-gospel:main Nov 9, 2023
2 checks passed
@n-osborne n-osborne deleted the fix-out-of-scope branch November 9, 2023 10:39
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.

qcheck-stm generates next_state function pattern matching on out of scope returned value
2 participants