nmodl
nmodl copied to clipboard
Make SympyVisitor fail on error.
Currently, when the SympyVisitor detects a bug, it simply prints a warning and continues. The tests also assert that the SympyVisitor is idempotent:
THEN("More SympySolver passes do nothing to the AST and don't throw") {
REQUIRE_NOTHROW(run_sympy_visitor_passes(*ast));
REQUIRE(AST_string == ast_to_string(*ast));
}
Unfortunately, the output of SymPy is not valid input to SymPy. This is why when it fails it the assumption is that the visitor already ran. Then it kindly warns, just in case the assumption is wrong and carries on.
Therefore, simple fixes such as: https://github.com/BlueBrain/nmodl/pull/1257
fail.
This leads to confusing error messages: https://github.com/BlueBrain/nmodl/issues/1258
@pramodk Do we need the property that the visitor can be reapplied, even though its output is invalid input?