Skip to content

Commit c681487

Browse files
Clarify function_type_argument_label error msg
[SR-2451] https://bugs.swift.org/browse/SR-2451
1 parent 75f4c58 commit c681487

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

include/swift/AST/DiagnosticsParse.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ ERROR(expected_type_before_arrow,none,
620620
ERROR(expected_type_after_arrow,none,
621621
"expected type after '->'", ())
622622
ERROR(function_type_argument_label,none,
623-
"function types cannot have argument label %0; use '_' instead",
623+
"function types cannot have argument labels; use '_' before %0",
624624
(Identifier))
625625

626626
// Enum Types

test/type/function/labels.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
// RUN: %target-swift-frontend -module-name TestModule -parse -verify %s
22

33
// Function type with various forms of argument label.
4-
typealias Function1 = (a: Int, // expected-error{{function types cannot have argument label 'a'; use '_' instead}}{{24-24=_ }}
4+
typealias Function1 = (a: Int, // expected-error{{function types cannot have argument labels; use '_' before 'a'}}{{24-24=_ }}
55
_ b: Int, // okay
6-
c d: Int, // expected-error{{function types cannot have argument label 'c'; use '_' instead}}{{24-25=_}}
7-
e _: Int, // expected-error{{function types cannot have argument label 'e'; use '_' instead}}{{24-29=}}
6+
c d: Int, // expected-error{{function types cannot have argument labels; use '_' before 'c'}}{{24-25=_}}
7+
e _: Int, // expected-error{{function types cannot have argument labels; use '_' before 'e'}}{{24-29=}}
88
_: Int, // okay
99
Int) // okay
1010
-> Int
1111

1212
// Throwing versions.
13-
typealias Function2 = (a: Int, // expected-error{{function types cannot have argument label 'a'; use '_' instead}}{{24-24=_ }}
13+
typealias Function2 = (a: Int, // expected-error{{function types cannot have argument labels; use '_' before 'a'}}{{24-24=_ }}
1414
_ b: Int, // okay
15-
c d: Int, // expected-error{{function types cannot have argument label 'c'; use '_' instead}}{{24-25=_}}
16-
e _: Int, // expected-error{{function types cannot have argument label 'e'; use '_' instead}}{{24-29=}}
15+
c d: Int, // expected-error{{function types cannot have argument labels; use '_' before 'c'}}{{24-25=_}}
16+
e _: Int, // expected-error{{function types cannot have argument labels; use '_' before 'e'}}{{24-29=}}
1717
_: Int, // okay
1818
Int) // okay
1919
throws -> Int
2020

21-
typealias Function3 = (a: Int, // expected-error{{function types cannot have argument label 'a'; use '_' instead}}{{24-24=_ }}
21+
typealias Function3 = (a: Int, // expected-error{{function types cannot have argument labels; use '_' before 'a'}}{{24-24=_ }}
2222
_ b: Int, // okay
23-
c d: Int, // expected-error{{function types cannot have argument label 'c'; use '_' instead}}{{24-25=_}}
24-
e _: Int, // expected-error{{function types cannot have argument label 'e'; use '_' instead}}{{24-29=}}
23+
c d: Int, // expected-error{{function types cannot have argument labels; use '_' before 'c'}}{{24-25=_}}
24+
e _: Int, // expected-error{{function types cannot have argument labels; use '_' before 'e'}}{{24-29=}}
2525
_: Int, // okay
2626
Int) // okay
2727
rethrows -> Int // expected-error{{only function declarations may be marked 'rethrows'}}

0 commit comments

Comments
 (0)