Skip to content

Commit cfa9de8

Browse files
committed
Parse: Address an llvm_unreachable that is actually reachable
1 parent b79f281 commit cfa9de8

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6337,8 +6337,8 @@ ParserStatus Parser::parseDecl(bool IsAtStartOfLineOrPreviousHadSemi,
63376337
DescriptiveKind = DescriptiveDeclKind::StaticProperty;
63386338
break;
63396339
case StaticSpellingKind::KeywordClass:
6340-
llvm_unreachable("kw_class is only parsed as a modifier if it's "
6341-
"followed by a keyword");
6340+
DescriptiveKind = DescriptiveDeclKind::ClassProperty;
6341+
break;
63426342
}
63436343

63446344
diagnose(Tok.getLoc(), diag::expected_keyword_in_decl, "var",
@@ -6366,8 +6366,7 @@ ParserStatus Parser::parseDecl(bool IsAtStartOfLineOrPreviousHadSemi,
63666366
DescriptiveKind = DescriptiveDeclKind::StaticMethod;
63676367
break;
63686368
case StaticSpellingKind::KeywordClass:
6369-
llvm_unreachable("kw_class is only parsed as a modifier if it's "
6370-
"followed by a keyword");
6369+
DescriptiveKind = DescriptiveDeclKind::ClassMethod;
63716370
}
63726371
}
63736372

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// {"signature":"swift::Parser::parseNewDeclAttribute(swift::DeclAttributes&, swift::SourceLoc, swift::DeclAttrKind, bool)::$_4::operator()() const"}
2-
// RUN: not --crash %target-swift-frontend -typecheck %s
2+
// RUN: not %target-swift-frontend -typecheck %s
33
class a {
44
class override b
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// {"signature":"swift::Parser::parseDecl(bool, bool, llvm::function_ref<void (swift::Decl*)>, bool)"}
2-
// RUN: not --crash %target-swift-frontend -typecheck %s
2+
// RUN: not %target-swift-frontend -typecheck %s
33
class a { class override ( override

0 commit comments

Comments
 (0)