Skip to content

Commit 2e71ef6

Browse files
authored
Merge pull request #14718 from xedin/rdar-37565861
[Diagnostics] Fix crash in `diagnoseSubscriptErrors`
2 parents 7e387b7 + b7e322d commit 2e71ef6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4640,10 +4640,12 @@ bool FailureDiagnosis::diagnoseSubscriptErrors(SubscriptExpr *SE,
46404640
UncurriedCandidate cand = calleeInfo.candidates[0];
46414641
auto candType = baseType->getTypeOfMember(CS.DC->getParentModule(),
46424642
cand.getDecl(), nullptr);
4643-
auto paramsType = candType->getAs<FunctionType>()->getInput();
4644-
if (!typeCheckChildIndependently(indexExpr, paramsType,
4645-
CTP_CallArgument, TCC_ForceRecheck))
4646-
return true;
4643+
if (auto *candFunc = candType->getAs<FunctionType>()) {
4644+
auto paramsType = candFunc->getInput();
4645+
if (!typeCheckChildIndependently(
4646+
indexExpr, paramsType, CTP_CallArgument, TCC_ForceRecheck))
4647+
return true;
4648+
}
46474649
}
46484650
}
46494651

0 commit comments

Comments
 (0)