Skip to content

Commit 5418568

Browse files
committed
Update diagnostics
1 parent c361108 commit 5418568

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5834,8 +5834,8 @@ ERROR(expansion_not_allowed,none,
58345834
"pack expansion %0 can only appear in a function parameter list, "
58355835
"tuple element, or generic argument of a variadic type", (Type))
58365836
ERROR(expansion_expr_not_allowed,none,
5837-
"value pack expansion can only appear inside a function argument list "
5838-
"or tuple element", ())
5837+
"value pack expansion can only appear inside a function argument list, "
5838+
"tuple element, or as the expression of a for-in loop", ())
58395839
ERROR(invalid_expansion_argument,none,
58405840
"cannot pass value pack expansion to non-pack parameter of type %0",
58415841
(Type))

test/Constraints/pack-expansion-expressions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ func concrete(_: Int) {}
290290

291291
func invalidRepeat<each T>(t: repeat each T) {
292292
_ = repeat each t
293-
// expected-error@-1 {{value pack expansion can only appear inside a function argument list or tuple element}}
293+
// expected-error@-1 {{value pack expansion can only appear inside a function argument list, tuple element, or as the expression of a for-in loop}}
294294

295295
let _: Int = repeat each t
296-
// expected-error@-1 {{value pack expansion can only appear inside a function argument list or tuple element}}
296+
// expected-error@-1 {{value pack expansion can only appear inside a function argument list, tuple element, or as the expression of a for-in loop}}
297297

298298
identity(identity(repeat each t))
299299
// expected-error@-1 {{cannot pass value pack expansion to non-pack parameter of type 'T'}}
@@ -302,7 +302,7 @@ func invalidRepeat<each T>(t: repeat each T) {
302302
// expected-error@-1 {{cannot pass value pack expansion to non-pack parameter of type 'Int'}}
303303

304304
_ = [repeat each t]
305-
// expected-error@-1 {{value pack expansion can only appear inside a function argument list or tuple element}}
305+
// expected-error@-1 {{value pack expansion can only appear inside a function argument list, tuple element, or as the expression of a for-in loop}}
306306
}
307307

308308
// Make sure that single parameter initializers are handled correctly because

test/Constraints/variadic_generic_functions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func contextualTyping() {
7474
do {
7575
func foo<each T>(_: repeat each T = bar().element) {} // expected-note {{in call to function 'foo'}}
7676
// expected-error@-1 {{variadic parameter cannot have a default value}}
77-
// expected-error@-2 {{value pack expansion can only appear inside a function argument list or tuple element}}
77+
// expected-error@-2 {{value pack expansion can only appear inside a function argument list, tuple element, or as the expression of a for-in loop}}
7878
// expected-error@-3 {{generic parameter 'each T' could not be inferred}}
7979

8080
func bar<each T>() -> (repeat each T) {}

0 commit comments

Comments
 (0)