File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -161,8 +161,24 @@ bool TypeVariableType::Implementation::isSubscriptResultType() const {
161161 if (!(locator && locator->getAnchor ()))
162162 return false ;
163163
164- return isExpr<SubscriptExpr>(locator->getAnchor ()) &&
165- locator->isLastElement <LocatorPathElt::FunctionResult>();
164+ if (!locator->isLastElement <LocatorPathElt::FunctionResult>())
165+ return false ;
166+
167+ if (isExpr<SubscriptExpr>(locator->getAnchor ()))
168+ return true ;
169+
170+ auto *KP = getAsExpr<KeyPathExpr>(locator->getAnchor ());
171+ if (!KP)
172+ return false ;
173+
174+ auto componentLoc = locator->findFirst <LocatorPathElt::KeyPathComponent>();
175+ if (!componentLoc)
176+ return false ;
177+
178+ auto &component = KP->getComponents ()[componentLoc->getIndex ()];
179+ return component.getKind () == KeyPathExpr::Component::Kind::Subscript ||
180+ component.getKind () ==
181+ KeyPathExpr::Component::Kind::UnresolvedSubscript;
166182}
167183
168184bool TypeVariableType::Implementation::isParameterPack () const {
You can’t perform that action at this time.
0 commit comments