Make user-defined sorts accessible in "\dl_" escapes #3659
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.
As described in #3402, user-defined sorts (from a .key file) cannot be used inside "\dl_" escapes. This PR changes this by reading the sorts and function/predicate definitions of the .key file before parsing JML. Note that the PR should also work for datatypes, since they are pretransformed into sorts and rules before reading the file. However, this is still untested.
In addition, this PR changes the handling of default values (relevant when declaring a ghost field of a user-defined sort).
Earlier, the default value was read from a doc comment
/*! @defaultValue(x) */attached to the sort declaration. However, this has drawbacks:xwas only allowed to be a constant, which is quite restrictiveWith this PR, the existing sort-depending constant
x::defaultValue(from heap.key) is used as default. A concrete value can be assigned with a taclet.Here is a small example with the sort IntPair:
Java File:
The PR is still a draft because I want to see if the tests succeed first. Also, the
x instanceof KeYFileseems a bit hacky, I don't know if it works for other cases ...Related Issue
This pull request resolves #3402.
Type of pull request
Ensuring quality
The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.