File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -8831,11 +8831,16 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar,
8831
8831
auto param = inferredClosureType->getParams ()[i];
8832
8832
auto *paramDecl = paramList->get (i);
8833
8833
8834
- // In case of anonymous parameters let's infer flags from context
8835
- // that helps to infer variadic and inout earlier.
8836
- if (closure->hasAnonymousClosureVars ()) {
8837
- if (auto contextualParam = getContextualParamAt (i))
8838
- param = param.withFlags (contextualParam->getParameterFlags ());
8834
+ // In case of anonymous or name-only parameters, let's infer inout/variadic
8835
+ // flags from context, that helps to propagate type information into the
8836
+ // internal type of the parameter and reduces inference solver has to make.
8837
+ if (!paramDecl->getTypeRepr ()) {
8838
+ if (auto contextualParam = getContextualParamAt (i)) {
8839
+ auto flags = param.getParameterFlags ();
8840
+ param =
8841
+ param.withFlags (flags.withInOut (contextualParam->isInOut ())
8842
+ .withVariadic (contextualParam->isVariadic ()));
8843
+ }
8839
8844
}
8840
8845
8841
8846
if (paramDecl->hasAttachedPropertyWrapper ()) {
You can’t perform that action at this time.
0 commit comments