Closed shym closed 11 months ago
Closes #153.
I think I would rather call the new exception
Partial_function
thanPartial_specification
as the second can be a bit misleading.
Indeed, in the message I wrote “Partial function in a spec...”, I don’t know why I went for something different in the name... :sweat_smile:
There are some Ortac/QCheck-STM specifics in the addition to
ortac-core
, but I guess that can be generalized in the future if it need to be.
My feeling was that the function term_with_catch
is currently used only by Ortac/QCheck-STM, but not really specific to it, which is why I placed it there. Wrapper contains a function fairly similar, it might be possible to rewrite them so that they share it.
This PR improves the error message when partial functions of the runtime, ie the ones that can raise exceptions at execution time, are called out of their definition domain in the QCheck-STM plugin.
For instance, running into a
List.hd []
during the test run will now display something like:which points to the clause where the
Failure
was raised.This PR thus adds:
Partial_specification
exception to the runtime,term_with_catch
function that wraps the translation of a term in order to raise thePartial_specification
exception if an exception is raised in the execution of a specification.Hopefully this improves #150.