Merged
Conversation
CatarinaGamboa
approved these changes
Nov 5, 2025
Collaborator
CatarinaGamboa
left a comment
There was a problem hiding this comment.
Good short fix, do you think in the future we can pinpoint why it is invalid? Like in this case the type of v is missing right, it could be great to add that so we can be more specific on the issues
Collaborator
Author
|
Yeah sure! |
Collaborator
Author
|
The issue is that the parsing doesn't fail here: public static AliasDTO getAliasDeclaration(String s) throws ParsingException {
Optional<String> os = getErrors(s);
if (os.isPresent()) // should fail here
throw new ParsingException(os.get());
// ...
}Since it doesn't throw a It only fails when it sees that the parse tree is not an alias (by returning public AliasDTO getAlias(ParseTree rc) {
if (rc instanceof AliasContext) {
// ...
return new AliasDTO(name, varTypes, varNames, ref);
} else if (rc.getChildCount() > 0) {
int i = rc.getChildCount();
if (i > 0) {
return getAlias(rc.getChild(0));
}
}
return null;
}Fow now I'll just follow the approach done in the ghost declaration parsing: AliasDTO alias = av.getAlias(rc);
if (alias == null)
throw new ParsingException("The alias should be in format <name>(<parameters>) { <definition> }");
return alias; |
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.
Previously, when a
@RefinementAliascontained an invalid definition, e.g. missing parameter type, it silently failed parsing and then would return a not found error when it was trying to be used.Example
Before:
After: