Skip to content

Commit 2588646

Browse files
committed
---
yaml --- r: 341999 b: refs/heads/rxwei-patch-1 c: f47f5c4 h: refs/heads/master i: 341997: ce736e0 341995: 372d6df 341991: a386ffb 341983: d929c74
1 parent ac1388b commit 2588646

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 5e528de547398ae35ddea5c4b3b74d41a0e7db03
1018+
refs/heads/rxwei-patch-1: f47f5c44e4580fe21e8a41d3fe36f705bff0962d
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4521,6 +4521,9 @@ WARNING(property_wrapper_init_initialValue,none,
45214521
())
45224522
ERROR(property_wrapper_projection_value_missing,none,
45234523
"could not find projection value property %0", (Identifier))
4524+
ERROR(property_wrapper_missing_arg_init, none, "missing argument for parameter "
4525+
"%0 in property wrapper initializer; add 'wrappedValue' and %0 "
4526+
"arguments in '@%1(...)'", (Identifier, StringRef))
45244527

45254528
//------------------------------------------------------------------------------
45264529
// MARK: function builder diagnostics

branches/rxwei-patch-1/lib/Sema/CSDiag.cpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,13 +3241,8 @@ class ArgumentMatcher : public MatchCallArgumentListener {
32413241
SmallString<32> insertBuf;
32423242
llvm::raw_svector_ostream insertText(insertBuf);
32433243

3244-
if (argIdx != 0) {
3245-
if (isPropertyWrapperImplicitInit()) {
3246-
insertText << "(";
3247-
} else {
3248-
insertText << ", ";
3249-
}
3250-
}
3244+
if (argIdx != 0)
3245+
insertText << ", ";
32513246
if (!name.empty())
32523247
insertText << name.str() << ": ";
32533248
Type Ty = param.getOldType();
@@ -3262,9 +3257,6 @@ class ArgumentMatcher : public MatchCallArgumentListener {
32623257
insertText << "<#" << Ty << "#>";
32633258
if (argIdx == 0 && insertableEndIdx != 0)
32643259
insertText << ", ";
3265-
if (isPropertyWrapperImplicitInit()) {
3266-
insertText << ")";
3267-
}
32683260

32693261
SourceLoc insertLoc;
32703262
if (argIdx > insertableEndIdx) {
@@ -3275,9 +3267,6 @@ class ArgumentMatcher : public MatchCallArgumentListener {
32753267
// fn(x: 1) { return 1 }
32763268
// is diagnosed as "missing argument for 'y'" (missingParamIdx 1).
32773269
// It should be "missing argument for 'z'" (missingParamIdx 2).
3278-
} else if (isPropertyWrapperImplicitInit()) {
3279-
insertLoc =
3280-
Lexer::getLocForEndOfToken(TC.Context.SourceMgr, FnExpr->getLoc());
32813270
} else if (auto *TE = dyn_cast<TupleExpr>(ArgExpr)) {
32823271
// fn():
32833272
// fn([argMissing])
@@ -3340,13 +3329,20 @@ class ArgumentMatcher : public MatchCallArgumentListener {
33403329

33413330
assert(insertLoc.isValid() && "missing argument after trailing closure?");
33423331

3343-
if (name.empty())
3332+
if (name.empty()) {
33443333
TC.diagnose(insertLoc, diag::missing_argument_positional,
33453334
missingParamIdx + 1)
33463335
.fixItInsert(insertLoc, insertText.str());
3347-
else
3348-
TC.diagnose(insertLoc, diag::missing_argument_named, name)
3349-
.fixItInsert(insertLoc, insertText.str());
3336+
} else {
3337+
if (isPropertyWrapperImplicitInit()) {
3338+
auto TE = cast<TypeExpr>(FnExpr);
3339+
TC.diagnose(TE->getLoc(), diag::property_wrapper_missing_arg_init, name,
3340+
TE->getInstanceType()->getString());
3341+
} else {
3342+
TC.diagnose(insertLoc, diag::missing_argument_named, name)
3343+
.fixItInsert(insertLoc, insertText.str());
3344+
}
3345+
}
33503346

33513347
auto candidate = CandidateInfo[0];
33523348
if (candidate.getDecl())

branches/rxwei-patch-1/test/decl/var/property_wrappers.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ struct InvalidPropertyDelegateUse {
10951095
// SR-11060
10961096

10971097
class SR_11060_Class {
1098-
@SR_11060_Wrapper var property: Int = 1234 // expected-error {{missing argument for parameter 'string' in call}}{{20-20=(string: <#String#>)}}
1098+
@SR_11060_Wrapper var property: Int = 1234 // expected-error {{missing argument for parameter 'string' in property wrapper initializer; add 'wrappedValue' and 'string' arguments in '@SR_11060_Wrapper(...)'}}
10991099
}
11001100

11011101
@propertyWrapper
@@ -1106,3 +1106,4 @@ struct SR_11060_Wrapper {
11061106
self.wrappedValue = wrappedValue
11071107
}
11081108
}
1109+

0 commit comments

Comments
 (0)