@@ -231,7 +231,9 @@ Solution::resolveConcreteDeclRef(ValueDecl *decl,
231231 if (!newFn)
232232 return ConcreteDeclRef (decl);
233233
234- auto newDecl = cast_or_null<ValueDecl>(decl->getASTContext ().getClangModuleLoader ()->importDeclDirectly (newFn));
234+ auto newDecl = cast_or_null<ValueDecl>(
235+ decl->getASTContext ().getClangModuleLoader ()->importDeclDirectly (
236+ newFn));
235237
236238 if (auto fn = dyn_cast<FuncDecl>(decl)) {
237239 if (newFn->getNumParams () != fn->getParameters ()->size ()) {
@@ -263,20 +265,26 @@ Solution::resolveConcreteDeclRef(ValueDecl *decl,
263265 !triple.isWindowsCygwinEnvironment () &&
264266 // Make sure we're substituting in at least one Int or UInt
265267 // (technically not necessary).
266- llvm::any_of (subst.getReplacementTypes (),[](Type t) {
268+ llvm::any_of (subst.getReplacementTypes (), [](Type t) {
267269 return t->isEqual (t->getASTContext ().getIntType ()) ||
268270 t->isEqual (t->getASTContext ().getUIntType ());
269271 })) {
270- auto originalFnSubst = cast<AbstractFunctionDecl>(decl)->getInterfaceType ()->getAs <GenericFunctionType>()->substGenericArgs (subst);
271- assert (fn->getParameters ()->size () == originalFnSubst->getParams ().size ());
272+ auto originalFnSubst = cast<AbstractFunctionDecl>(decl)
273+ ->getInterfaceType ()
274+ ->getAs <GenericFunctionType>()
275+ ->substGenericArgs (subst);
276+ assert (fn->getParameters ()->size () ==
277+ originalFnSubst->getParams ().size ());
272278 SmallVector<ParamDecl *, 4 > fixedParameters;
273279 unsigned parameterIndex = 0 ;
274280 for (auto *newFnParam : *fn->getParameters ()) {
275281 // If the user substituted this param with an (U)Int, use (U)Int.
276- auto substParamType = originalFnSubst->getParams ()[parameterIndex].getParameterType ();
282+ auto substParamType =
283+ originalFnSubst->getParams ()[parameterIndex].getParameterType ();
277284 if (substParamType->isEqual (fn->getASTContext ().getIntType ()) ||
278285 substParamType->isEqual (fn->getASTContext ().getUIntType ())) {
279- auto intParam = ParamDecl::cloneWithoutType (fn->getASTContext (), newFnParam);
286+ auto intParam =
287+ ParamDecl::cloneWithoutType (fn->getASTContext (), newFnParam);
280288 intParam->setInterfaceType (substParamType);
281289 fixedParameters.push_back (intParam);
282290 } else {
@@ -287,17 +295,21 @@ Solution::resolveConcreteDeclRef(ValueDecl *decl,
287295
288296 assert (fn->getParameters ()->size () == fixedParameters.size ());
289297
290- auto fixedParams = ParameterList::create (fn->getASTContext (), fixedParameters);
298+ auto fixedParams =
299+ ParameterList::create (fn->getASTContext (), fixedParameters);
291300 fn->setParameters (fixedParams);
292301
293302 // Now fix the result type:
294- if (originalFnSubst->getResult ()->isEqual (fn->getASTContext ().getIntType ()) ||
295- originalFnSubst->getResult ()->isEqual (fn->getASTContext ().getUIntType ())) {
303+ if (originalFnSubst->getResult ()->isEqual (
304+ fn->getASTContext ().getIntType ()) ||
305+ originalFnSubst->getResult ()->isEqual (
306+ fn->getASTContext ().getUIntType ())) {
296307 // Constructors don't have a result.
297308 if (auto func = dyn_cast<FuncDecl>(fn)) {
298309 newDecl = FuncDecl::createImplicit (
299- func->getASTContext (), func->getStaticSpelling (), func->getName (),
300- func->getNameLoc (), func->hasAsync (), func->hasThrows (),
310+ func->getASTContext (), func->getStaticSpelling (),
311+ func->getName (), func->getNameLoc (), func->hasAsync (),
312+ func->hasThrows (),
301313 /* genericParams=*/ nullptr , fixedParams,
302314 originalFnSubst->getResult (), func->getDeclContext ());
303315 }
0 commit comments