[Type checker] Fix a crash triggered from index-while-building.

This commit is contained in:
Doug Gregor
2019-09-11 14:28:35 -07:00
parent 9ce12ac422
commit 7151d0e3d7
2 changed files with 26 additions and 1 deletions

View File

@@ -4783,7 +4783,8 @@ performMemberLookup(ConstraintKind constraintKind, DeclName memberName,
// as representing "dynamic lookup" unless it's a direct call
// to such subscript (in that case label is expected to match).
if (auto *subscript = dyn_cast<SubscriptDecl>(cand)) {
if (::hasDynamicMemberLookupAttribute(instanceTy,
if (memberLocator &&
::hasDynamicMemberLookupAttribute(instanceTy,
DynamicMemberLookupCache) &&
isValidKeyPathDynamicMemberLookup(subscript, TC)) {
auto info = getArgumentInfo(memberLocator);