Open
Conversation
CatarinaGamboa
requested changes
Mar 1, 2026
| Optional<String> s = getErrors(toParse); | ||
| if (s.isPresent()) | ||
| throw new SyntaxError(s.get(), toParse); | ||
| throw new SyntaxError("Invalid refinement expression, e.g. \"v > 0\"", toParse); |
Collaborator
There was a problem hiding this comment.
The example in the PR confused me, I was thinking "why would i need to write v instead of x"? We have to be careful, so it isn't more confusing than helpful.
Maybe we could just have "it should be a logical predicate"
| AliasDTO alias = av.getAlias(rc); | ||
| if (alias == null) | ||
| throw new SyntaxError("Alias definitions should be in format <name>(<parameters>) { <definition> }", s); | ||
| throw new SyntaxError("Invalid alias definition, e.g. \"Positive(int v) { v >= 0 }\"", s); |
Collaborator
There was a problem hiding this comment.
Lets include the whole alias reference like @RefinementAlias("...")
| GhostDTO g = GhostVisitor.getGhostDecl(rc); | ||
| if (g == null) | ||
| throw new SyntaxError("Ghost declarations should be in format <type> <name> (<parameters>)", s); | ||
| throw new SyntaxError("Invalid ghost declaration, e.g. \"int size\"", s); |
Collaborator
There was a problem hiding this comment.
Lets include the whole alias reference like @Ghost("int size") to ensure that it is perceptible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR improves the syntax error messages of refinements, ghosts, and aliases, and includes example usages of those.
Examples
In the future we'll include these examples as hints rather than in the error message itself.