Skip to content

Commit e4cbe81

Browse files
committed
Sema: Fix crash when any is followed by something that doesn't parse as a type
1 parent 9e3487e commit e4cbe81

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/Parse/ParseExpr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ ParserResult<Expr> Parser::parseExprSequenceElement(Diag<> message,
503503
peekToken().isContextualPunctuator("~")) &&
504504
!peekToken().isAtStartOfLine()) {
505505
ParserResult<TypeRepr> ty = parseType();
506+
if (ty.isNull())
507+
return nullptr;
508+
506509
auto *typeExpr = new (Context) TypeExpr(ty.get());
507510
return makeParserResult(typeExpr);
508511
}

0 commit comments

Comments
 (0)