@@ -36,8 +36,7 @@ bool ArgumentTypeCheckCompletionCallback::addPossibleParams(
3636 return true ;
3737 }
3838
39- ArrayRef<AnyFunctionType::Param> ParamsToPass =
40- Res.FuncTy ->getAs <AnyFunctionType>()->getParams ();
39+ ArrayRef<AnyFunctionType::Param> ParamsToPass = Res.FuncTy ->getParams ();
4140
4241 ParameterList *PL = nullptr ;
4342 if (Res.FuncD ) {
@@ -167,8 +166,12 @@ void ArgumentTypeCheckCompletionCallback::sawSolutionImpl(const Solution &S) {
167166 llvm::SmallDenseMap<const VarDecl *, Type> SolutionSpecificVarTypes;
168167 getSolutionSpecificVarTypes (S, SolutionSpecificVarTypes);
169168
169+ AnyFunctionType *FuncTy = nullptr ;
170+ if (Info.ValueTy ) {
171+ FuncTy = Info.ValueTy ->lookThroughAllOptionalTypes ()->getAs <AnyFunctionType>();
172+ }
170173 Results.push_back ({ExpectedTy, isa<SubscriptExpr>(ParentCall), Info.Value ,
171- Info. ValueTy , ArgIdx, ParamIdx, std::move (ClaimedParams),
174+ FuncTy , ArgIdx, ParamIdx, std::move (ClaimedParams),
172175 IsNoninitialVariadic, Info.BaseTy , HasLabel, IsAsync,
173176 SolutionSpecificVarTypes});
174177}
@@ -216,8 +219,7 @@ void ArgumentTypeCheckCompletionCallback::deliverResults(
216219 }
217220 }
218221 if (Result.FuncTy ) {
219- if (auto FuncTy = Result.FuncTy ->lookThroughAllOptionalTypes ()
220- ->getAs <AnyFunctionType>()) {
222+ if (auto FuncTy = Result.FuncTy ) {
221223 if (Result.IsSubscript ) {
222224 assert (SemanticContext != SemanticContextKind::None);
223225 auto *SD = dyn_cast_or_null<SubscriptDecl>(Result.FuncD );
0 commit comments