Skip to content

Read old(this) in a precondition as the state before the call - #422

Open
CatarinaGamboa wants to merge 1 commit into
mainfrom
fix/state-machine-old
Open

CatarinaGamboa wants to merge 1 commit into
mainfrom
fix/state-machine-old

Conversation

@CatarinaGamboa

Copy link
Copy Markdown
Collaborator

Why

The state machine builder sent preconditions that mention old(this) to the solver without replacing old. One example is the expert DatagramSocket spec's from = "closed(this) && connected(old(this))". The solver failed with Ghost 'old' could not be found, and since the analysis is best effort, every state error on such a class lost its hints, its category and (since #421) its StateErrorContext.

The liquidjava-fsm test that checks the verifier's states against the diagram found this.

What

In StateMachineBuilder.transitionsOf, old(this) in a precondition now means the state before the call, which is how AuxStateHandler.changeState reads it (changeOldMentions(name, name)).

Tests

ErrorStateHintOldInPrecondition with TestStateHints#oldInAPreconditionIsTheStateBeforeTheCall. It fails without the fix and passes with it. On the fsm DatagramSocket client, the error now gets the path-dependent hint. mvn test: 494 tests pass.

🤖 Generated with Claude Code

The state machine builder passed preconditions such as
"closed(this) && connected(old(this))" to the solver with old() still in
them, so building the machine failed and errors on such classes got no
hints, category or state context. Replace old(this) with the state before
the call, as the verifier does when it checks the call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant