Skip to content

Commit af49a90

Browse files
committed
Customize diagnostic text for extra/missing/mislabeled arguments for callee kind
Most of the diagnostics for extra/missing/mislabeled arguments refer to argument to a "call". Some (but not call) would substitute in "subscript". None would refer to an argument to a macro expansion properly. Rework all of these to refer to the argument in a call, subscript, or macro expansion as appropriate. Fix up lots of tests that now say "subscript" instead, and add tests for macro expansions.
1 parent bdc01ea commit af49a90

File tree

11 files changed

+122
-63
lines changed

11 files changed

+122
-63
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,15 +1271,18 @@ ERROR(missing_init_on_metatype_initialization,none,
12711271
"initializing from a metatype value must reference 'init' explicitly",
12721272
())
12731273
ERROR(extra_argument_labels,none,
1274-
"extraneous argument label%select{|s}0 '%1' in %select{call|subscript}2",
1275-
(bool, StringRef, bool))
1274+
"extraneous argument label%select{|s}0 '%1' in "
1275+
"%select{call|subscript|macro expansion}2",
1276+
(bool, StringRef, unsigned))
12761277
ERROR(missing_argument_labels,none,
1277-
"missing argument label%select{|s}0 '%1' in %select{call|subscript}2",
1278-
(bool, StringRef, bool))
1278+
"missing argument label%select{|s}0 '%1' in "
1279+
"%select{call|subscript|macro expansion}2",
1280+
(bool, StringRef, unsigned))
12791281
ERROR(wrong_argument_labels,none,
1280-
"incorrect argument label%select{|s}0 in %select{call|subscript}3 "
1282+
"incorrect argument label%select{|s}0 in "
1283+
"%select{call|subscript|macro expansion}3 "
12811284
"(have '%1', expected '%2')",
1282-
(bool, StringRef, StringRef, bool))
1285+
(bool, StringRef, StringRef, unsigned))
12831286
ERROR(argument_out_of_order_named_named,none,
12841287
"argument %0 must precede argument %1", (Identifier, Identifier))
12851288
ERROR(argument_out_of_order_named_unnamed,none,
@@ -1313,22 +1316,29 @@ ERROR(instance_member_in_default_parameter,none,
13131316
"cannot use instance member %0 as a default parameter", (DeclNameRef))
13141317

13151318
ERROR(missing_argument_named,none,
1316-
"missing argument for parameter %0 in call", (Identifier))
1319+
"missing argument for parameter %0 in "
1320+
"%select{call|subscript|macro expansion}1", (Identifier, unsigned))
13171321
ERROR(missing_argument_positional,none,
1318-
"missing argument for parameter #%0 in call", (unsigned))
1322+
"missing argument for parameter #%0 in "
1323+
"%select{call|subscript|macro expansion}1", (unsigned, unsigned))
13191324
ERROR(missing_arguments_in_call,none,
1320-
"missing arguments for parameters %0 in call", (StringRef))
1325+
"missing arguments for parameters %0 in "
1326+
"%select{call|subscript|macro expansion}1", (StringRef, unsigned))
13211327
ERROR(extra_argument_named,none,
1322-
"extra argument %0 in call", (Identifier))
1328+
"extra argument %0 in %select{call|subscript|macro expansion}1",
1329+
(Identifier, unsigned))
13231330
ERROR(extra_argument_positional,none,
1324-
"extra argument in call", ())
1331+
"extra argument in %select{call|subscript|macro expansion}0",
1332+
(unsigned))
13251333
ERROR(extra_arguments_in_call,none,
13261334
"extra %select{arguments|trailing closures}0 at positions %1 in call",
13271335
(bool, StringRef))
13281336
ERROR(extra_argument_to_nullary_call,none,
1329-
"argument passed to call that takes no arguments", ())
1337+
"argument passed to %select{call|subscript|macro expansion}0 "
1338+
"that takes no arguments", (unsigned))
13301339
ERROR(extra_trailing_closure_in_call,none,
1331-
"extra trailing closure passed in call", ())
1340+
"extra trailing closure passed in "
1341+
"%select{call|subscript|macro expansion}0", (unsigned))
13321342
ERROR(trailing_closure_bad_param,none,
13331343
"trailing closure passed to parameter of type %0 that does not "
13341344
"accept a closure", (Type))

lib/Sema/CSDiagnostics.cpp

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -907,13 +907,25 @@ bool GenericArgumentsMismatchFailure::diagnoseAsError() {
907907
return true;
908908
}
909909

910+
/// Determine the parameter context to use for diagnostics purposes.
911+
static ParameterContext getParameterContextForDiag(ASTNode anchor) {
912+
if (isExpr<SubscriptExpr>(anchor))
913+
return ParameterContext::Subscript;
914+
915+
if (isExpr<MacroExpansionExpr>(anchor))
916+
return ParameterContext::MacroExpansion;
917+
918+
return ParameterContext::Call;
919+
}
920+
910921
bool LabelingFailure::diagnoseAsError() {
911922
auto *args = getArgumentListFor(getLocator());
912923
if (!args)
913924
return false;
914925

926+
auto paramContext = getParameterContextForDiag(getRawAnchor());
915927
return diagnoseArgumentLabelError(getASTContext(), args, CorrectLabels,
916-
isExpr<SubscriptExpr>(getRawAnchor()));
928+
paramContext);
917929
}
918930

919931
bool LabelingFailure::diagnoseAsNote() {
@@ -4699,7 +4711,10 @@ bool MissingArgumentsFailure::diagnoseAsError() {
46994711
},
47004712
[&] { arguments << ", "; });
47014713

4702-
auto diag = emitDiagnostic(diag::missing_arguments_in_call, arguments.str());
4714+
auto paramContext = getParameterContextForDiag(getRawAnchor());
4715+
auto diag = emitDiagnostic(
4716+
diag::missing_arguments_in_call, arguments.str(),
4717+
static_cast<unsigned>(paramContext));
47034718

47044719
auto callInfo = getCallInfo(anchor);
47054720
auto *args = callInfo ? callInfo->second : nullptr;
@@ -4760,6 +4775,8 @@ bool MissingArgumentsFailure::diagnoseSingleMissingArgument() const {
47604775
if (SynthesizedArgs.size() != 1)
47614776
return false;
47624777

4778+
auto paramContext = getParameterContextForDiag(anchor);
4779+
47634780
const auto &argument = SynthesizedArgs.front();
47644781
auto position = argument.paramIdx;
47654782
auto label = argument.param.getLabel();
@@ -4870,7 +4887,8 @@ bool MissingArgumentsFailure::diagnoseSingleMissingArgument() const {
48704887

48714888
if (label.empty()) {
48724889
auto diag = emitDiagnosticAt(
4873-
insertLoc, diag::missing_argument_positional, position + 1);
4890+
insertLoc, diag::missing_argument_positional, position + 1,
4891+
static_cast<unsigned>(paramContext));
48744892
if (shouldEmitFixIt)
48754893
diag.fixItInsert(insertLoc, insertText.str());
48764894
} else if (isPropertyWrapperInitialization()) {
@@ -4879,7 +4897,8 @@ bool MissingArgumentsFailure::diagnoseSingleMissingArgument() const {
48794897
label, resolveType(TE->getInstanceType())->getString());
48804898
} else {
48814899
auto diag = emitDiagnosticAt(
4882-
insertLoc, diag::missing_argument_named, label);
4900+
insertLoc, diag::missing_argument_named, label,
4901+
static_cast<unsigned>(paramContext));
48834902
if (shouldEmitFixIt)
48844903
diag.fixItInsert(insertLoc, insertText.str());
48854904
}
@@ -5481,7 +5500,9 @@ bool ExtraneousArgumentsFailure::diagnoseAsError() {
54815500

54825501
if (ContextualType->getNumParams() == 0) {
54835502
if (auto *args = getArgumentListFor(getLocator())) {
5484-
emitDiagnostic(diag::extra_argument_to_nullary_call)
5503+
auto paramContext = getParameterContextForDiag(getRawAnchor());
5504+
emitDiagnostic(diag::extra_argument_to_nullary_call,
5505+
static_cast<unsigned>(paramContext))
54855506
.highlight(args->getSourceRange())
54865507
.fixItRemove(args->getSourceRange());
54875508
return true;
@@ -5534,14 +5555,16 @@ bool ExtraneousArgumentsFailure::diagnoseAsNote() {
55345555

55355556
bool ExtraneousArgumentsFailure::diagnoseSingleExtraArgument() const {
55365557
auto *locator = getLocator();
5558+
auto paramContext = getParameterContextForDiag(getRawAnchor());
55375559

55385560
// This specifically handles a case of `Void(...)` which generates
55395561
// constraints differently from other constructor invocations and
55405562
// wouldn't have `ApplyArgument` as a last element in the locator.
55415563
if (auto *call = getAsExpr<CallExpr>(getRawAnchor())) {
55425564
auto *TE = dyn_cast<TypeExpr>(call->getFn());
55435565
if (TE && getType(TE)->getMetatypeInstanceType()->isVoid()) {
5544-
emitDiagnosticAt(call->getLoc(), diag::extra_argument_to_nullary_call)
5566+
emitDiagnosticAt(call->getLoc(), diag::extra_argument_to_nullary_call,
5567+
static_cast<unsigned>(paramContext))
55455568
.highlight(call->getArgs()->getSourceRange());
55465569
return true;
55475570
}
@@ -5554,26 +5577,31 @@ bool ExtraneousArgumentsFailure::diagnoseSingleExtraArgument() const {
55545577
const auto &e = ExtraArgs.front();
55555578
auto index = e.first;
55565579
auto argument = e.second;
5557-
55585580
auto *argExpr = arguments->getExpr(index);
55595581
auto loc = argExpr->getLoc();
55605582
if (arguments->isTrailingClosureIndex(index)) {
5561-
emitDiagnosticAt(loc, diag::extra_trailing_closure_in_call)
5562-
.highlight(argExpr->getSourceRange());
5583+
emitDiagnosticAt(
5584+
loc, diag::extra_trailing_closure_in_call,
5585+
static_cast<unsigned>(paramContext)
5586+
).highlight(argExpr->getSourceRange());
55635587
} else if (ContextualType->getNumParams() == 0) {
55645588
auto *subExpr = arguments->getUnlabeledUnaryExpr();
55655589
if (subExpr && argument.getPlainType()->isVoid()) {
5566-
emitDiagnosticAt(loc, diag::extra_argument_to_nullary_call)
5590+
emitDiagnosticAt(loc, diag::extra_argument_to_nullary_call,
5591+
static_cast<unsigned>(paramContext))
55675592
.fixItRemove(subExpr->getSourceRange());
55685593
} else {
5569-
emitDiagnosticAt(loc, diag::extra_argument_to_nullary_call)
5594+
emitDiagnosticAt(loc, diag::extra_argument_to_nullary_call,
5595+
static_cast<unsigned>(paramContext))
55705596
.highlight(arguments->getSourceRange());
55715597
}
55725598
} else if (argument.hasLabel()) {
5573-
emitDiagnosticAt(loc, diag::extra_argument_named, argument.getLabel())
5599+
emitDiagnosticAt(loc, diag::extra_argument_named, argument.getLabel(),
5600+
static_cast<unsigned>(paramContext))
55745601
.highlight(arguments->getSourceRange());
55755602
} else {
5576-
emitDiagnosticAt(loc, diag::extra_argument_positional)
5603+
emitDiagnosticAt(loc, diag::extra_argument_positional,
5604+
static_cast<unsigned>(paramContext))
55775605
.highlight(arguments->getSourceRange());
55785606
}
55795607
return true;

lib/Sema/MiscDiagnostics.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,7 +2029,7 @@ bool TypeChecker::getDefaultGenericArgumentsString(
20292029
bool swift::diagnoseArgumentLabelError(ASTContext &ctx,
20302030
const ArgumentList *argList,
20312031
ArrayRef<Identifier> newNames,
2032-
bool isSubscript,
2032+
ParameterContext paramContext,
20332033
InFlightDiagnostic *existingDiag) {
20342034
Optional<InFlightDiagnostic> diagOpt;
20352035
auto getDiag = [&]() -> InFlightDiagnostic & {
@@ -2120,18 +2120,20 @@ bool swift::diagnoseArgumentLabelError(ASTContext &ctx,
21202120
diagOpt.emplace(diags.diagnose(argList->getLoc(),
21212121
diag::wrong_argument_labels,
21222122
plural, haveStr, expectedStr,
2123-
isSubscript));
2123+
static_cast<unsigned>(paramContext)));
21242124
} else if (numMissing > 0) {
21252125
StringRef missingStr = missingBuffer;
21262126
diagOpt.emplace(diags.diagnose(argList->getLoc(),
21272127
diag::missing_argument_labels,
2128-
plural, missingStr, isSubscript));
2128+
plural, missingStr,
2129+
static_cast<unsigned>(paramContext)));
21292130
} else {
21302131
assert(numExtra > 0);
21312132
StringRef extraStr = extraBuffer;
21322133
diagOpt.emplace(diags.diagnose(argList->getLoc(),
21332134
diag::extra_argument_labels,
2134-
plural, extraStr, isSubscript));
2135+
plural, extraStr,
2136+
static_cast<unsigned>(paramContext)));
21352137
}
21362138
}
21372139

lib/Sema/MiscDiagnostics.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ void fixItAccess(InFlightDiagnostic &diag,
5959
bool isForSetter = false,
6060
bool shouldUseDefaultAccess = false);
6161

62+
/// Describes the context of a parameter, for use in diagnosing argument
63+
/// label problems.
64+
enum class ParameterContext: unsigned {
65+
Call = 0,
66+
Subscript = 1,
67+
MacroExpansion = 2
68+
};
69+
6270
/// Emit fix-its to correct the argument labels in \p argList.
6371
///
6472
/// If \p existingDiag is null, the fix-its will be attached to an appropriate
@@ -68,7 +76,7 @@ void fixItAccess(InFlightDiagnostic &diag,
6876
bool diagnoseArgumentLabelError(ASTContext &ctx,
6977
const ArgumentList *argList,
7078
ArrayRef<Identifier> newNames,
71-
bool isSubscript,
79+
ParameterContext paramContext,
7280
InFlightDiagnostic *existingDiag = nullptr);
7381

7482
/// If \p assignExpr has a destination expression that refers to a declaration

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2550,8 +2550,10 @@ static void fixItAvailableAttrRename(InFlightDiagnostic &diag,
25502550
if (originalArgs->isUnlabeledTrailingClosureIndex(i))
25512551
continue;
25522552
if (argumentLabelIDs[i] != originalArgs->getLabel(i)) {
2553+
auto paramContext = parsed.IsSubscript ? ParameterContext::Subscript
2554+
: ParameterContext::Call;
25532555
diagnoseArgumentLabelError(ctx, originalArgs, argumentLabelIDs,
2554-
parsed.IsSubscript, &diag);
2556+
paramContext, &diag);
25552557
return;
25562558
}
25572559
}

test/Constraints/diag_missing_arg.swift

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -105,59 +105,59 @@ struct S1 {
105105
var s1 = S1()
106106
_ = s1[x: 1, y: {1}] // Ok.
107107
_ = s1[x: 1] { 1 } // Ok.
108-
_ = s1[x: 1] // expected-error {{missing argument for parameter 'y' in call}} {{12-12=, y: <#() -> Int#>}}
109-
_ = s1[y: { 1 }] // expected-error {{missing argument for parameter 'x' in call}} {{8-8=x: <#Int#>, }}
110-
_ = s1[] { 1 } // expected-error {{missing argument for parameter 'x' in call}} {{8-8=x: <#Int#>}}
108+
_ = s1[x: 1] // expected-error {{missing argument for parameter 'y' in subscript}} {{12-12=, y: <#() -> Int#>}}
109+
_ = s1[y: { 1 }] // expected-error {{missing argument for parameter 'x' in subscript}} {{8-8=x: <#Int#>, }}
110+
_ = s1[] { 1 } // expected-error {{missing argument for parameter 'x' in subscript}} {{8-8=x: <#Int#>}}
111111
_ = s1 { 1 } // expected-error {{cannot call value of non-function type 'S1'}} {{none}}
112-
_ = s1[] // expected-error {{missing arguments for parameters 'x', 'y' in call}} {{8-8=x: <#Int#>, y: <#() -> Int#>}}
112+
_ = s1[] // expected-error {{missing arguments for parameters 'x', 'y' in subscript}} {{8-8=x: <#Int#>, y: <#() -> Int#>}}
113113
s1[x: 1, y: {1}] = 1 // Ok.
114114
s1[x: 1] { 1 } = 1 // Ok.
115-
s1[x: 1] = 1 // expected-error {{missing argument for parameter 'y' in call}} {{8-8=, y: <#() -> Int#>}}
116-
s1[y: { 1 }] = 1 // expected-error {{missing argument for parameter 'x' in call}} {{4-4=x: <#Int#>, }}
117-
s1[] { 1 } = 1 // expected-error {{missing argument for parameter 'x' in call}} {{4-4=x: <#Int#>}}
115+
s1[x: 1] = 1 // expected-error {{missing argument for parameter 'y' in subscript}} {{8-8=, y: <#() -> Int#>}}
116+
s1[y: { 1 }] = 1 // expected-error {{missing argument for parameter 'x' in subscript}} {{4-4=x: <#Int#>, }}
117+
s1[] { 1 } = 1 // expected-error {{missing argument for parameter 'x' in subscript}} {{4-4=x: <#Int#>}}
118118

119119
struct S2 {
120120
subscript(x: Int, y: () -> Int) -> Int { get { return 1 } set { } } // expected-note * {{here}}
121121
}
122122
var s2 = S2()
123123
_ = s2[1, {1}] // Ok.
124124
_ = s2[1] { 1 } // Ok.
125-
_ = s2[1] // expected-error {{missing argument for parameter #2 in call}} {{9-9=, <#() -> Int#>}}
126-
_ = s2[{ 1 }] // expected-error {{missing argument for parameter #1 in call}} {{8-8=<#Int#>, }}
127-
_ = s2[] { 1 } // expected-error {{missing argument for parameter #1 in call}} {{8-8=<#Int#>}}
125+
_ = s2[1] // expected-error {{missing argument for parameter #2 in subscript}} {{9-9=, <#() -> Int#>}}
126+
_ = s2[{ 1 }] // expected-error {{missing argument for parameter #1 in subscript}} {{8-8=<#Int#>, }}
127+
_ = s2[] { 1 } // expected-error {{missing argument for parameter #1 in subscript}} {{8-8=<#Int#>}}
128128
_ = s2 { 1 } // expected-error {{cannot call value of non-function type 'S2'}} {{none}}
129-
_ = s2[] // expected-error {{missing arguments for parameters #1, #2 in call}} {{8-8=<#Int#>, <#() -> Int#>}}
129+
_ = s2[] // expected-error {{missing arguments for parameters #1, #2 in subscript}} {{8-8=<#Int#>, <#() -> Int#>}}
130130
s2[1, {1}] = 1 // Ok.
131131
s2[1] { 1 } = 1 // Ok.
132-
s2[1] = 1 // expected-error {{missing argument for parameter #2 in call}} {{5-5=, <#() -> Int#>}}
133-
s2[{ 1 }] = 1 // expected-error {{missing argument for parameter #1 in call}} {{4-4=<#Int#>, }}
134-
s2[] { 1 } = 1 // expected-error {{missing argument for parameter #1 in call}} {{4-4=<#Int#>}}
132+
s2[1] = 1 // expected-error {{missing argument for parameter #2 in subscript}} {{5-5=, <#() -> Int#>}}
133+
s2[{ 1 }] = 1 // expected-error {{missing argument for parameter #1 in subscript}} {{4-4=<#Int#>, }}
134+
s2[] { 1 } = 1 // expected-error {{missing argument for parameter #1 in subscript}} {{4-4=<#Int#>}}
135135

136136
struct S3 {
137137
subscript(x x: Int, y y: Int, z z: (Int) -> Int) -> Int { get { return 1 } set { } } // expected-note * {{here}}
138138
}
139139
var s3 = S3()
140-
_ = s3[y: 1] { 1 } // expected-error {{missing argument for parameter 'x' in call}} {{8-8=x: <#Int#>, }}
140+
_ = s3[y: 1] { 1 } // expected-error {{missing argument for parameter 'x' in subscript}} {{8-8=x: <#Int#>, }}
141141
// expected-error@-1 {{contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored}} {{15-15= _ in}}
142-
_ = s3[x: 1] { 1 } // expected-error {{missing argument for parameter 'y' in call}} {{12-12=, y: <#Int#>}}
142+
_ = s3[x: 1] { 1 } // expected-error {{missing argument for parameter 'y' in subscript}} {{12-12=, y: <#Int#>}}
143143
// expected-error@-1 {{contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored}} {{15-15= _ in}}
144-
_ = s3[x: 1, y: 1] // expected-error {{missing argument for parameter 'z' in call}} {{18-18=, z: <#(Int) -> Int#>}}
145-
s3[y: 1] { 1 } = 1 // expected-error {{missing argument for parameter 'x' in call}} {{4-4=x: <#Int#>, }}
144+
_ = s3[x: 1, y: 1] // expected-error {{missing argument for parameter 'z' in subscript}} {{18-18=, z: <#(Int) -> Int#>}}
145+
s3[y: 1] { 1 } = 1 // expected-error {{missing argument for parameter 'x' in subscript}} {{4-4=x: <#Int#>, }}
146146
// expected-error@-1 {{contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored}} {{11-11= _ in}}
147-
s3[x: 1] { 1 } = 1 // expected-error {{missing argument for parameter 'y' in call}} {{8-8=, y: <#Int#>}}
147+
s3[x: 1] { 1 } = 1 // expected-error {{missing argument for parameter 'y' in subscript}} {{8-8=, y: <#Int#>}}
148148
// expected-error@-1 {{contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored}} {{11-11= _ in}}
149-
s3[x: 1, y: 1] = 1 // expected-error {{missing argument for parameter 'z' in call}} {{14-14=, z: <#(Int) -> Int#>}}
149+
s3[x: 1, y: 1] = 1 // expected-error {{missing argument for parameter 'z' in subscript}} {{14-14=, z: <#(Int) -> Int#>}}
150150

151151
struct S4 {
152152
subscript(x: Int, y: Int, z: (Int) -> Int) -> Int { get { return 1 } set { } } // expected-note * {{here}}
153153
}
154154
var s4 = S4()
155-
_ = s4[1] { 1 } // expected-error {{missing argument for parameter #2 in call}} {{9-9=, <#Int#>}}
155+
_ = s4[1] { 1 } // expected-error {{missing argument for parameter #2 in subscript}} {{9-9=, <#Int#>}}
156156
// expected-error@-1 {{contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored}} {{12-12= _ in}}
157-
_ = s4[1, 1] // expected-error {{missing argument for parameter #3 in call}} {{12-12=, <#(Int) -> Int#>}}
158-
s4[1] { 1 } = 1 // expected-error {{missing argument for parameter #2 in call}} {{5-5=, <#Int#>}}
157+
_ = s4[1, 1] // expected-error {{missing argument for parameter #3 in subscript}} {{12-12=, <#(Int) -> Int#>}}
158+
s4[1] { 1 } = 1 // expected-error {{missing argument for parameter #2 in subscript}} {{5-5=, <#Int#>}}
159159
// expected-error@-1 {{contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored}} {{8-8= _ in}}
160-
s4[1, 1] = 1 // expected-error {{missing argument for parameter #3 in call}} {{8-8=, <#(Int) -> Int#>}}
160+
s4[1, 1] = 1 // expected-error {{missing argument for parameter #3 in subscript}} {{8-8=, <#(Int) -> Int#>}}
161161

162162
func multiLine(x: Int, y: Int, z: Int) {} // expected-note * {{here}}
163163
multiLine( // expected-error {{missing arguments for parameters 'x', 'y', 'z' in call}} {{11-11=x: <#Int#>, y: <#Int#>, z: <#Int#>}}

test/Constraints/lvalues.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ struct G<T> {
240240
func wump<T>(to: T, _ body: (G<T>) -> ()) {}
241241

242242
wump(to: 0, { $0[] = 0 })
243-
// expected-error@-1 {{missing argument for parameter #1 in call}}
243+
// expected-error@-1 {{missing argument for parameter #1 in subscript}}
244244

245245
// https://github.com/apple/swift/issues/56129
246246

test/Constraints/members.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ func rdar_50467583_and_50909555() {
645645

646646
func test(_ s: S) {
647647
s[1] // expected-error {{static member 'subscript' cannot be used on instance of type 'S'}} {{5-6=S}}
648-
// expected-error@-1 {{missing argument for parameter #2 in call}} {{8-8=, <#Int#>}}
648+
// expected-error@-1 {{missing argument for parameter #2 in subscript}} {{8-8=, <#Int#>}}
649649
}
650650
}
651651

0 commit comments

Comments
 (0)