@@ -770,45 +770,25 @@ static std::tuple<ValueDecl *, bool, ArrayRef<Identifier>, bool,
770
770
ConstraintLocator *>
771
771
getCalleeDeclAndArgs (ConstraintSystem &cs,
772
772
ConstraintLocatorBuilder callBuilder) {
773
- auto formUnknownCallee =
774
- []() -> std::tuple<ValueDecl *, bool , ArrayRef<Identifier>, bool ,
775
- ConstraintLocator *> {
776
- return std::make_tuple (/* decl*/ nullptr , /* hasAppliedSelf*/ false ,
777
- /* argLabels*/ ArrayRef<Identifier>(),
778
- /* hasTrailingClosure*/ false ,
779
- /* calleeLocator*/ nullptr );
780
- };
781
-
782
773
auto *callLocator = cs.getConstraintLocator (callBuilder);
783
- auto *callExpr = callLocator->getAnchor ();
784
-
785
- // Break down the call.
786
- if (!callExpr)
787
- return formUnknownCallee ();
788
-
789
- // Our remaining path can only be 'ApplyArgument'.
790
- auto path = callLocator->getPath ();
791
- if (!path.empty () && !path.back ().is <LocatorPathElt::ApplyArgument>())
792
- return formUnknownCallee ();
774
+ assert (callLocator->isLastElement <LocatorPathElt::ApplyArgument>());
793
775
794
- // Dig out the callee information.
776
+ // Dig out the argument information.
795
777
auto argInfo = cs.getArgumentInfo (callLocator);
796
- if (!argInfo)
797
- return formUnknownCallee ();
778
+ assert (argInfo);
798
779
799
780
auto argLabels = argInfo->Labels ;
800
781
auto hasTrailingClosure = argInfo->HasTrailingClosure ;
801
- auto calleeLocator = cs.getCalleeLocator (callLocator);
802
782
803
783
// Find the overload choice corresponding to the callee locator.
784
+ auto *calleeLocator = cs.getCalleeLocator (callLocator);
804
785
auto selectedOverload = cs.findSelectedOverloadFor (calleeLocator);
805
786
806
787
// If we didn't find any matching overloads, we're done. Just return the
807
788
// argument info.
808
789
if (!selectedOverload)
809
790
return std::make_tuple (/* decl*/ nullptr , /* hasAppliedSelf*/ false ,
810
- argLabels, hasTrailingClosure,
811
- /* calleeLocator*/ nullptr );
791
+ argLabels, hasTrailingClosure, calleeLocator);
812
792
813
793
// Return the found declaration, assuming there is one.
814
794
auto choice = selectedOverload->choice ;
0 commit comments