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.
Hello,
I've noticed that there is a precondition the
char
override forStringFormulaManager.range
:However, the JavaDoc for the (general)
range
method does not mention this restriction:And, according to SMTLIB, empty ranges should be fine:
I've tried it out with different solvers, and only CVC4 seems to cause issues when the precondition in the
default
method is simply removed. CVC5 and Princess still assume that the bounds are single character Strings and will throw an exception otherwise. However, they can handle the case when the lower bound is larger than the upper bound and simply return the empty language. Z3 supports both cases, and will also return the empty language when one of the bounds is not a single character String.In this PR I removed the precondition from the
default
override to make sure it matches the behavior of the general method. I also added some checks to prevent crashes on CVC5 and Princess if either of the bounds is not a single character Strings, and fixed two bugs for Princess. Note that there are still some issues on CVC4, but this will be hard to fix as the solver is no longer maintained.