Skip to content

Commit ea929ad

Browse files
committed
---
yaml --- r: 349053 b: refs/heads/master c: e23b373 h: refs/heads/master i: 349051: 95dfed6
1 parent b5830e1 commit ea929ad

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 370f47c27a80a12e8ddb73c586782825cd883c22
2+
refs/heads/master: e23b37383059ac43f64906e60eab99236f6dbadb
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/Sema/TypeCheckPropertyWrapper.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,34 +125,28 @@ findSuitableWrapperInit(ASTContext &ctx, NominalTypeDecl *nominal,
125125
continue;
126126

127127
ParamDecl *argumentParam = nullptr;
128-
bool allArgsDefault = true;
128+
bool hasExtraneousParam = false;
129129
// Check whether every parameter meets one of the following criteria:
130130
// (1) The parameter has a default argument, or
131131
// (2) The parameter has the given argument label.
132132
for (auto param : *init->getParameters()) {
133133
// Recognize the first parameter with the requested argument label.
134-
if (param->getArgumentName() == argumentLabel && !argumentParam) {
134+
if (!argumentLabel.empty() && param->getArgumentName() == argumentLabel &&
135+
!argumentParam) {
135136
argumentParam = param;
136137
continue;
137138
}
138139

139-
if (param->isDefaultArgument()) {
140-
allArgsDefault &= true;
140+
if (param->isDefaultArgument())
141141
continue;
142-
} else {
143-
// Forget we had a match.
144-
allArgsDefault = false;
145-
argumentParam = nullptr;
146-
break;
147-
}
148-
}
149142

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+
}
152147

153-
if (initKind == PropertyWrapperInitKind::Default && !allArgsDefault) {
148+
if (hasExtraneousParam)
154149
continue;
155-
}
156150

157151
// Failable initializers cannot be used.
158152
if (init->isFailable()) {

0 commit comments

Comments
 (0)