Skip to content

Commit fb5b9c8

Browse files
committed
[CSDiagnostics] Add assertion for trailing pack element
1 parent bb45b60 commit fb5b9c8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8202,7 +8202,9 @@ bool UnableToInferClosureReturnType::diagnoseAsError() {
82028202
bool UnableToInferGenericPackElementType::diagnoseAsError() {
82038203
auto *locator = getLocator();
82048204
auto path = locator->getPath();
8205-
const auto packElementElt = (path.end() - 1)->getAs<LocatorPathElt::PackElement>();
8205+
8206+
auto packElementElt = (path.end() - 1)->getAs<LocatorPathElt::PackElement>();
8207+
assert(packElementElt && "Expected path to end with a pack element locator");
82068208

82078209
if (isExpr<NilLiteralExpr>(getAnchor())) {
82088210
// `nil` appears as an element of generic pack params, let's record a

0 commit comments

Comments
 (0)