Introduce ModelVarContext
as a generalisation of ModelLookup
and ModelFindVariables
#25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Occurrences of
ModelFindVariables
andModelLookup
in theInLockstep
class are replaced by the newly exposedModelVarContext
. AModelFindVariables
can be recovered from aModelVarContext
using the newfindVars
functions. AModelLookup
can be recovered from aModelVarContext
using the newlookupVars
function. Since these functions can be recovered fromModelVarContext
, existing tests are guaranteed to be adaptable to the newInLockstep
API.Motivation: previously in the
InLockstep
class, member functions would be passed aModelFindVariables
or aModelLookup
, but never both. In practice this turned out to be too restrictive, because one might want access to both in the same function, see IntersectMBO/lsm-tree#431. For example,arbitraryWithVars
was previously only passed aModelFindVariables
, but without aModelLookup
one can not filter these variables based on the (modelled) outcome of the corresponding actions. The use case for #431 in particular was to filter variables that reference stateful handles (e.g., file handles) for handles that are open. Because of this filtering, one can skew the action distribution to generate more actions on open handles. It is often more interesting to test actions on open handles than it is to test actions on closed handles, which will presumably always return the same error.