@@ -125,34 +125,28 @@ findSuitableWrapperInit(ASTContext &ctx, NominalTypeDecl *nominal,
125
125
continue ;
126
126
127
127
ParamDecl *argumentParam = nullptr ;
128
- bool allArgsDefault = true ;
128
+ bool hasExtraneousParam = false ;
129
129
// Check whether every parameter meets one of the following criteria:
130
130
// (1) The parameter has a default argument, or
131
131
// (2) The parameter has the given argument label.
132
132
for (auto param : *init->getParameters ()) {
133
133
// Recognize the first parameter with the requested argument label.
134
- if (param->getArgumentName () == argumentLabel && !argumentParam) {
134
+ if (!argumentLabel.empty () && param->getArgumentName () == argumentLabel &&
135
+ !argumentParam) {
135
136
argumentParam = param;
136
137
continue ;
137
138
}
138
139
139
- if (param->isDefaultArgument ()) {
140
- allArgsDefault &= true ;
140
+ if (param->isDefaultArgument ())
141
141
continue ;
142
- } else {
143
- // Forget we had a match.
144
- allArgsDefault = false ;
145
- argumentParam = nullptr ;
146
- break ;
147
- }
148
- }
149
142
150
- if (initKind != PropertyWrapperInitKind::Default && !argumentParam)
151
- continue ;
143
+ // Skip this init as the param doesn't meet the above criteria
144
+ hasExtraneousParam = true ;
145
+ break ;
146
+ }
152
147
153
- if (initKind == PropertyWrapperInitKind::Default && !allArgsDefault) {
148
+ if (hasExtraneousParam)
154
149
continue ;
155
- }
156
150
157
151
// Failable initializers cannot be used.
158
152
if (init->isFailable ()) {
0 commit comments