Skip to content

Add the receiver's possible states to the error context #10

Closed

Description

@CatarinaGamboa

The VS Code State Machine view needs the states the receiver can be in at a failing call, so it can split them into the states the call accepts and the states it rejects (liquid-java/vscode-liquidjava#158).

Given:

  • P: the states the receiver can be in, from the Found condition;
  • A: the states the call accepts, from the Expected condition (expectedStates).

The view shows Valid = P ∩ A and Invalid = P \ A.

actualStates only covers some forms of Found and is not documented as P. A dedicated field states exactly what the view relies on.

Proposal

Add possibleStates to StateMachineErrorContext: the states, in state set order, that the receiver's Found premises allow. Use the same evaluation as expectedStates (||, !, ternaries), and intersect across conjoined premises. When nothing is known about the receiver, return every state.

Tests

  • DatagramSocket after if (exit) socket.close(); else socket.send(p); then socket.receive(p). Found is flag ? closed(socket) : bound(socket), so P = {bound, closed} and A = {unbound, bound, connected}. This is the vscode-liquidjava test example E_OSS_A1_22_UdpChatClient.
  • A negated Found, such as !closed(s).
  • The existing DefaultMutableTreeNode and Door fixtures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions