Skip to content

Commit 9969582

Browse files
committed
[Diagnostics] Adjust single parameter splat message to prefix substitutions with with
1 parent 760d78c commit 9969582

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3535,7 +3535,7 @@ bool InvalidTupleSplatWithSingleParameterFailure::diagnoseAsError() {
35353535

35363536
std::string subsStr;
35373537
if (!substitutions.empty()) {
3538-
subsStr += " [where ";
3538+
subsStr += " [with ";
35393539
interleave(
35403540
substitutions,
35413541
[&subsStr](const std::pair<GenericParamKey, Substitution> &e) {

test/Constraints/keyword_arguments.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ func acceptTuple1<T>(_ x: (T, Bool)) { }
399399

400400
acceptTuple1(produceTuple1())
401401
acceptTuple1((1, false))
402-
acceptTuple1(1, false) // expected-error {{global function 'acceptTuple1' expects a single parameter of type '(T, Bool)' [where T = Int]}} {{14-14=(}} {{22-22=)}}
402+
acceptTuple1(1, false) // expected-error {{global function 'acceptTuple1' expects a single parameter of type '(T, Bool)' [with T = Int]}} {{14-14=(}} {{22-22=)}}
403403

404404
func acceptTuple2<T>(_ input : T) -> T { return input }
405405
var tuple1 = (1, "hello")

test/Constraints/tuple_arguments.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ do {
8080
genericTwo(3, 4)
8181
genericTwo((3, 4)) // expected-error {{missing argument for parameter #2 in call}}
8282

83-
genericTuple(3, 4) // expected-error {{global function 'genericTuple' expects a single parameter of type '(T, U)' [where T = Int, U = Int]}} {{16-16=(}} {{20-20=)}}
83+
genericTuple(3, 4) // expected-error {{global function 'genericTuple' expects a single parameter of type '(T, U)' [with T = Int, U = Int]}} {{16-16=(}} {{20-20=)}}
8484
genericTuple((3, 4))
8585
}
8686

@@ -101,7 +101,7 @@ do {
101101
genericTwo((a, b)) // expected-error {{missing argument for parameter #2 in call}}
102102
genericTwo(d) // expected-error {{missing argument for parameter #2 in call}}
103103

104-
genericTuple(a, b) // expected-error {{global function 'genericTuple' expects a single parameter of type '(T, U)' [where T = Int, U = Int]}} {{16-16=(}} {{20-20=)}}
104+
genericTuple(a, b) // expected-error {{global function 'genericTuple' expects a single parameter of type '(T, U)' [with T = Int, U = Int]}} {{16-16=(}} {{20-20=)}}
105105
genericTuple((a, b))
106106
genericTuple(d)
107107
}
@@ -123,7 +123,7 @@ do {
123123
genericTwo((a, b)) // expected-error {{missing argument for parameter #2 in call}}
124124
genericTwo(d) // expected-error {{missing argument for parameter #2 in call}}
125125

126-
genericTuple(a, b) // expected-error {{global function 'genericTuple' expects a single parameter of type '(T, U)' [where T = Int, U = Int]}} {{16-16=(}} {{20-20=)}}
126+
genericTuple(a, b) // expected-error {{global function 'genericTuple' expects a single parameter of type '(T, U)' [with T = Int, U = Int]}} {{16-16=(}} {{20-20=)}}
127127
genericTuple((a, b))
128128
genericTuple(d)
129129
}
@@ -267,7 +267,7 @@ do {
267267
s.genericTwo(3, 4)
268268
s.genericTwo((3, 4)) // expected-error {{missing argument for parameter #2 in call}}
269269

270-
s.genericTuple(3, 4) // expected-error {{instance method 'genericTuple' expects a single parameter of type '(T, U)' [where T = Int, U = Int]}} {{18-18=(}} {{22-22=)}}
270+
s.genericTuple(3, 4) // expected-error {{instance method 'genericTuple' expects a single parameter of type '(T, U)' [with T = Int, U = Int]}} {{18-18=(}} {{22-22=)}}
271271
s.genericTuple((3, 4))
272272
}
273273

@@ -289,7 +289,7 @@ do {
289289
s.genericTwo((a, b)) // expected-error {{missing argument for parameter #2 in call}}
290290
s.genericTwo(d) // expected-error {{missing argument for parameter #2 in call}}
291291

292-
s.genericTuple(a, b) // expected-error {{instance method 'genericTuple' expects a single parameter of type '(T, U)' [where T = Int, U = Int]}} {{18-18=(}} {{22-22=)}}
292+
s.genericTuple(a, b) // expected-error {{instance method 'genericTuple' expects a single parameter of type '(T, U)' [with T = Int, U = Int]}} {{18-18=(}} {{22-22=)}}
293293
s.genericTuple((a, b))
294294
s.genericTuple(d)
295295
}
@@ -312,7 +312,7 @@ do {
312312
s.genericTwo((a, b)) // expected-error {{missing argument for parameter #2 in call}}
313313
s.genericTwo(d) // expected-error {{missing argument for parameter #2 in call}}
314314

315-
s.genericTuple(a, b) // expected-error {{instance method 'genericTuple' expects a single parameter of type '(T, U)' [where T = Int, U = Int]}} {{18-18=(}} {{22-22=)}}
315+
s.genericTuple(a, b) // expected-error {{instance method 'genericTuple' expects a single parameter of type '(T, U)' [with T = Int, U = Int]}} {{18-18=(}} {{22-22=)}}
316316
s.genericTuple((a, b))
317317
s.genericTuple(d)
318318
}
@@ -401,7 +401,7 @@ do {
401401
s.mutatingGenericTwo(3, 4)
402402
s.mutatingGenericTwo((3, 4)) // expected-error {{missing argument for parameter #2 in call}}
403403

404-
s.mutatingGenericTuple(3, 4) // expected-error {{instance method 'mutatingGenericTuple' expects a single parameter of type '(T, U)' [where T = Int, U = Int]}} {{26-26=(}} {{30-30=)}}
404+
s.mutatingGenericTuple(3, 4) // expected-error {{instance method 'mutatingGenericTuple' expects a single parameter of type '(T, U)' [with T = Int, U = Int]}} {{26-26=(}} {{30-30=)}}
405405
s.mutatingGenericTuple((3, 4))
406406
}
407407

@@ -423,7 +423,7 @@ do {
423423
s.mutatingGenericTwo((a, b)) // expected-error {{missing argument for parameter #2 in call}}
424424
s.mutatingGenericTwo(d) // expected-error {{missing argument for parameter #2 in call}}
425425

426-
s.mutatingGenericTuple(a, b) // expected-error {{instance method 'mutatingGenericTuple' expects a single parameter of type '(T, U)' [where T = Int, U = Int]}} {{26-26=(}} {{30-30=)}}
426+
s.mutatingGenericTuple(a, b) // expected-error {{instance method 'mutatingGenericTuple' expects a single parameter of type '(T, U)' [with T = Int, U = Int]}} {{26-26=(}} {{30-30=)}}
427427
s.mutatingGenericTuple((a, b))
428428
s.mutatingGenericTuple(d)
429429
}
@@ -446,7 +446,7 @@ do {
446446
s.mutatingGenericTwo((a, b)) // expected-error {{missing argument for parameter #2 in call}}
447447
s.mutatingGenericTwo(d) // expected-error {{missing argument for parameter #2 in call}}
448448

449-
s.mutatingGenericTuple(a, b) // expected-error {{instance method 'mutatingGenericTuple' expects a single parameter of type '(T, U)' [where T = Int, U = Int]}} {{26-26=(}} {{30-30=)}}
449+
s.mutatingGenericTuple(a, b) // expected-error {{instance method 'mutatingGenericTuple' expects a single parameter of type '(T, U)' [with T = Int, U = Int]}} {{26-26=(}} {{30-30=)}}
450450
s.mutatingGenericTuple((a, b))
451451
s.mutatingGenericTuple(d)
452452
}
@@ -937,10 +937,10 @@ do {
937937
_ = GenericInitTwo(3, 4)
938938
_ = GenericInitTwo((3, 4)) // expected-error {{missing argument for parameter #2 in call}}
939939

940-
_ = GenericInitTuple(3, 4) // expected-error {{initializer expects a single parameter of type '(T, T)' [where T = Int]}} {{24-24=(}} {{28-28=)}}
940+
_ = GenericInitTuple(3, 4) // expected-error {{initializer expects a single parameter of type '(T, T)' [with T = Int]}} {{24-24=(}} {{28-28=)}}
941941
_ = GenericInitTuple((3, 4))
942942

943-
_ = GenericInitLabeledTuple(x: 3, 4) // expected-error {{initializer expects a single parameter of type '(T, T)' [where T = Int]}}
943+
_ = GenericInitLabeledTuple(x: 3, 4) // expected-error {{initializer expects a single parameter of type '(T, T)' [with T = Int]}}
944944
_ = GenericInitLabeledTuple(x: (3, 4))
945945
}
946946

@@ -974,7 +974,7 @@ do {
974974
_ = GenericInitTwo((a, b)) // expected-error {{missing argument for parameter #2 in call}}
975975
_ = GenericInitTwo(c) // expected-error {{missing argument for parameter #2 in call}}
976976

977-
_ = GenericInitTuple(a, b) // expected-error {{initializer expects a single parameter of type '(T, T)' [where T = Int]}} {{24-24=(}} {{28-28=)}}
977+
_ = GenericInitTuple(a, b) // expected-error {{initializer expects a single parameter of type '(T, T)' [with T = Int]}} {{24-24=(}} {{28-28=)}}
978978
_ = GenericInitTuple((a, b))
979979
_ = GenericInitTuple(c)
980980
}
@@ -1010,7 +1010,7 @@ do {
10101010
_ = GenericInitTwo((a, b)) // expected-error {{missing argument for parameter #2 in call}}
10111011
_ = GenericInitTwo(c) // expected-error {{missing argument for parameter #2 in call}}
10121012

1013-
_ = GenericInitTuple(a, b) // expected-error {{initializer expects a single parameter of type '(T, T)' [where T = Int]}} {{24-24=(}} {{28-28=)}}
1013+
_ = GenericInitTuple(a, b) // expected-error {{initializer expects a single parameter of type '(T, T)' [with T = Int]}} {{24-24=(}} {{28-28=)}}
10141014
_ = GenericInitTuple((a, b))
10151015
_ = GenericInitTuple(c)
10161016
}
@@ -1137,7 +1137,7 @@ do {
11371137
_ = GenericEnum.two(3, 4)
11381138
_ = GenericEnum.two((3, 4)) // expected-error {{missing argument for parameter #2 in call}}
11391139

1140-
_ = GenericEnum.tuple(3, 4) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)' [where T = Int]}} {{25-25=(}} {{29-29=)}}
1140+
_ = GenericEnum.tuple(3, 4) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)' [with T = Int]}} {{25-25=(}} {{29-29=)}}
11411141
_ = GenericEnum.tuple((3, 4))
11421142
}
11431143

@@ -1170,7 +1170,7 @@ do {
11701170
_ = GenericEnum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
11711171
_ = GenericEnum.two(c) // expected-error {{missing argument for parameter #2 in call}}
11721172

1173-
_ = GenericEnum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)' [where T = Int]}} {{25-25=(}} {{29-29=)}}
1173+
_ = GenericEnum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)' [with T = Int]}} {{25-25=(}} {{29-29=)}}
11741174
_ = GenericEnum.tuple((a, b))
11751175
_ = GenericEnum.tuple(c)
11761176
}
@@ -1206,7 +1206,7 @@ do {
12061206
_ = GenericEnum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
12071207
_ = GenericEnum.two(c) // expected-error {{missing argument for parameter #2 in call}}
12081208

1209-
_ = GenericEnum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)' [where T = Int]}} {{25-25=(}} {{29-29=)}}
1209+
_ = GenericEnum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)' [with T = Int]}} {{25-25=(}} {{29-29=)}}
12101210
_ = GenericEnum.tuple((a, b))
12111211
_ = GenericEnum.tuple(c)
12121212
}

0 commit comments

Comments
 (0)