Better error message for when type variable instances are not found for :checking #1357
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.
Addresses #1345
The problem: due to nondeterminism in the SMT solver, using
:check
on a property with numeric constraints can sometimes find and sometimes not find concrete instances for some numeric type variables. If the instance is not found, then the user is presented with the error messageCannot evaluate polymorphic value.
which is misleading because, in fact, another run of:check
might find an instance and to testing just fine.In
Cryptol.REPL.Monad
, this PR introduces a new constructor toREPLException
,which is very similar to
EvalPolyError
, which is the misleading exception raised in #1345. The exceptionInstantiationsNotFound
is only thrown when the user:check
s a property, anddefaultReplExpr'
fails to find a model (assignment of type variables) that satisfies the type constraints (list ofProp
s). This failure mode is now reflected in the type ofreplEvalCheckedExpr
which now returnsREPL (Maybe ...)
, which allows the different call sites ofreplEvalCheckedExpr
to handle the solver failure differently.Now, the feedback a user gets they try the example in #1345 is:
However, further work needs to be done to properly support testing for polymorphic properties. This PR merely makes the lacking capability less confusing for the user.