Skip to content

Preserve skipped paths for boolean if conditions - #382

Open
CatarinaGamboa wants to merge 1 commit into
mainfrom
fix/issue-371-boolean-if
Open

CatarinaGamboa wants to merge 1 commit into
mainfrom
fix/issue-371-boolean-if

Conversation

@CatarinaGamboa

Copy link
Copy Markdown
Collaborator

An if (again) { r.reopen(); } following r.close() previously allowed r.use() even though the skipped branch leaves r closed. The join used the condition's refinement relation as its guard, which made the then branch appear selected whenever that relation held.

Keep expression value constraints separate from the boolean guard used for branch assumptions and state joins. Unannotated calls and calls with constraints independent of their return value retain both possible outcomes. Preserve the value constraints after the join without asserting that the condition is true.

Regression examples cover unsafe boolean variables, refined calls, unannotated calls, and calls with independent constraints; passing examples cover known true and false values, negation, repeated guards, and safe joins with and without an explicit else.

Validation: ./mvnw -pl liquidjava-verifier -am test -Dsurefire.failIfNoSpecifiedTests=false passes on main including #366. All five new fixtures also pass when run directly after rebasing.

Fixes #371.

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.

Soundness: an if without else on a bare boolean drops the path where the branch is not taken

2 participants