mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 10:20:41 +00:00
parent
5e6cb6ca4c
commit
08085ad44d
@ -331,7 +331,11 @@ public class TypeAssumptionParser {
|
||||
ParserResult<Type> result = handleInnerParenthesis(
|
||||
new Token(TokenType.EOF, "", "", -1));
|
||||
if (result.isError()) {
|
||||
return result.castError();
|
||||
return result
|
||||
// replace dummy EOF token
|
||||
.modifyError(err ->
|
||||
err.withToken(t, ParseError.ErrorType.TYPE_ASSUMPTION_ERROR))
|
||||
.castError();
|
||||
} else {
|
||||
parsedType = Optional.of(result.getResult());
|
||||
stateParenthesis = Optional.empty();
|
||||
|
@ -359,6 +359,16 @@ class TypeAssumptionParserTest {
|
||||
e);
|
||||
}
|
||||
|
||||
@Test
|
||||
void errorCase4() {
|
||||
ParseError e = parse("s:()");
|
||||
assertEquals(ParseError
|
||||
.unexpectedToken(new Token(Token.TokenType.RIGHT_PARENTHESIS, ")", "s:()", 3),
|
||||
ParseError.ErrorType.TYPE_ASSUMPTION_ERROR)
|
||||
.expectedInput(ExpectedInput.TYPE),
|
||||
e);
|
||||
}
|
||||
|
||||
static ParseError parse(String input) {
|
||||
return new TypeAssumptionParser().parse(input).unwrapError();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user