@@ -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 ) {
@@ -176,8 +175,12 @@ void ArgumentTypeCheckCompletionCallback::sawSolutionImpl(const Solution &S) {
176175 llvm::SmallDenseMap<const VarDecl *, Type> SolutionSpecificVarTypes;
177176 getSolutionSpecificVarTypes (S, SolutionSpecificVarTypes);
178177
178+ AnyFunctionType *FuncTy = nullptr ;
179+ if (Info.ValueTy ) {
180+ FuncTy = Info.ValueTy ->lookThroughAllOptionalTypes ()->getAs <AnyFunctionType>();
181+ }
179182 Results.push_back ({ExpectedTy, isa<SubscriptExpr>(ParentCall), Info.Value ,
180- Info. ValueTy , ArgIdx, ParamIdx, std::move (ClaimedParams),
183+ FuncTy , ArgIdx, ParamIdx, std::move (ClaimedParams),
181184 IsNoninitialVariadic, Info.BaseTy , HasLabel, IsAsync,
182185 SolutionSpecificVarTypes});
183186}
@@ -225,8 +228,7 @@ void ArgumentTypeCheckCompletionCallback::deliverResults(
225228 }
226229 }
227230 if (Result.FuncTy ) {
228- if (auto FuncTy = Result.FuncTy ->lookThroughAllOptionalTypes ()
229- ->getAs <AnyFunctionType>()) {
231+ if (auto FuncTy = Result.FuncTy ) {
230232 if (Result.IsSubscript ) {
231233 assert (SemanticContext != SemanticContextKind::None);
232234 auto *SD = dyn_cast_or_null<SubscriptDecl>(Result.FuncD );
0 commit comments