@@ -29,7 +29,10 @@ final class AsyncTests: XCTestCase {
29
29
assertParse (
30
30
" func asyncGlobal3() throws 1️⃣async { } " ,
31
31
diagnostics: [
32
- DiagnosticSpec ( message: " 'async' must precede 'throws' " , fixIts: [ " move 'async' in front of 'throws' " ] )
32
+ DiagnosticSpec (
33
+ message: " 'async' must precede 'throws' " ,
34
+ fixIts: [ " move 'async' in front of 'throws' " ]
35
+ )
33
36
] ,
34
37
fixedSource: " func asyncGlobal3() async throws { } "
35
38
)
@@ -39,7 +42,10 @@ final class AsyncTests: XCTestCase {
39
42
assertParse (
40
43
" func asyncGlobal3(fn: () throws -> Int) rethrows 1️⃣async { } " ,
41
44
diagnostics: [
42
- DiagnosticSpec ( message: " 'async' must precede 'rethrows' " , fixIts: [ " move 'async' in front of 'rethrows' " ] )
45
+ DiagnosticSpec (
46
+ message: " 'async' must precede 'rethrows' " ,
47
+ fixIts: [ " move 'async' in front of 'rethrows' " ]
48
+ )
43
49
] ,
44
50
fixedSource: " func asyncGlobal3(fn: () throws -> Int) async rethrows { } "
45
51
)
@@ -49,7 +55,10 @@ final class AsyncTests: XCTestCase {
49
55
assertParse (
50
56
" func asyncGlobal4() -> Int 1️⃣async { } " ,
51
57
diagnostics: [
52
- DiagnosticSpec ( message: " 'async' must preceed '->' " , fixIts: [ " move 'async' in front of '->' " ] )
58
+ DiagnosticSpec (
59
+ message: " 'async' must preceed '->' " ,
60
+ fixIts: [ " move 'async' in front of '->' " ]
61
+ )
53
62
] ,
54
63
fixedSource: " func asyncGlobal4() async -> Int { } "
55
64
)
@@ -59,7 +68,10 @@ final class AsyncTests: XCTestCase {
59
68
assertParse (
60
69
" func asyncGlobal5() -> Int 1️⃣async throws { } " ,
61
70
diagnostics: [
62
- DiagnosticSpec ( message: " 'async throws' must preceed '->' " , fixIts: [ " move 'async throws' in front of '->' " ] )
71
+ DiagnosticSpec (
72
+ message: " 'async throws' must preceed '->' " ,
73
+ fixIts: [ " move 'async throws' in front of '->' " ]
74
+ )
63
75
] ,
64
76
fixedSource: " func asyncGlobal5() async throws -> Int { } "
65
77
)
@@ -69,7 +81,10 @@ final class AsyncTests: XCTestCase {
69
81
assertParse (
70
82
" func asyncGlobal6() -> Int 1️⃣throws async { } " ,
71
83
diagnostics: [
72
- DiagnosticSpec ( message: " 'throws async' must preceed '->' " , fixIts: [ " move 'throws async' in front of '->' " ] )
84
+ DiagnosticSpec (
85
+ message: " 'throws async' must preceed '->' " ,
86
+ fixIts: [ " move 'throws async' in front of '->' " ]
87
+ )
73
88
] ,
74
89
fixedSource: " func asyncGlobal6() async throws -> Int { } "
75
90
)
@@ -79,7 +94,10 @@ final class AsyncTests: XCTestCase {
79
94
assertParse (
80
95
" func asyncGlobal7() throws -> Int 1️⃣async { } " ,
81
96
diagnostics: [
82
- DiagnosticSpec ( message: " 'async' must preceed '->' " , fixIts: [ " move 'async' in front of '->' " ] )
97
+ DiagnosticSpec (
98
+ message: " 'async' must preceed '->' " ,
99
+ fixIts: [ " move 'async' in front of '->' " ]
100
+ )
83
101
] ,
84
102
fixedSource: " func asyncGlobal7() async throws -> Int { } "
85
103
)
@@ -88,12 +106,25 @@ final class AsyncTests: XCTestCase {
88
106
func testAsync8( ) {
89
107
assertParse (
90
108
"""
91
- func asyncGlobal8() async throws 1️⃣async -> 2️⃣async Int 3️⃣async {}
109
+ func asyncGlobal8() ℹ️async throws 1️⃣async -> 2️⃣async Int 3️⃣async {}
92
110
""" ,
93
111
diagnostics: [
94
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " 'async' has already been specified " , fixIts: [ " remove redundant 'async' " ] ) ,
95
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " 'async' must preceed '->' " , fixIts: [ " remove redundant 'async' " ] ) ,
96
- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " 'async' must preceed '->' " , fixIts: [ " remove redundant 'async' " ] ) ,
112
+ DiagnosticSpec (
113
+ locationMarker: " 1️⃣ " ,
114
+ message: " 'async' has already been specified " ,
115
+ notes: [ NoteSpec ( message: " 'async' declared here " ) ] ,
116
+ fixIts: [ " remove redundant 'async' " ]
117
+ ) ,
118
+ DiagnosticSpec (
119
+ locationMarker: " 2️⃣ " ,
120
+ message: " 'async' must preceed '->' " ,
121
+ fixIts: [ " remove redundant 'async' " ]
122
+ ) ,
123
+ DiagnosticSpec (
124
+ locationMarker: " 3️⃣ " ,
125
+ message: " 'async' must preceed '->' " ,
126
+ fixIts: [ " remove redundant 'async' " ]
127
+ ) ,
97
128
] ,
98
129
fixedSource: """
99
130
func asyncGlobal8() async throws -> Int {}
@@ -118,7 +149,11 @@ final class AsyncTests: XCTestCase {
118
149
}
119
150
""" ,
120
151
diagnostics: [
121
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " deinitializers cannot have a name " , fixIts: [ " remove 'async' " ] ) ,
152
+ DiagnosticSpec (
153
+ locationMarker: " 1️⃣ " ,
154
+ message: " deinitializers cannot have a name " ,
155
+ fixIts: [ " remove 'async' " ]
156
+ ) ,
122
157
DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " unexpected code 'async' in subscript " ) ,
123
158
]
124
159
)
@@ -144,7 +179,10 @@ final class AsyncTests: XCTestCase {
144
179
assertParse (
145
180
" typealias AsyncFunc3 = () throws 1️⃣async -> () " ,
146
181
diagnostics: [
147
- DiagnosticSpec ( message: " 'async' must precede 'throws' " , fixIts: [ " move 'async' in front of 'throws' " ] )
182
+ DiagnosticSpec (
183
+ message: " 'async' must precede 'throws' " ,
184
+ fixIts: [ " move 'async' in front of 'throws' " ]
185
+ )
148
186
] ,
149
187
fixedSource: " typealias AsyncFunc3 = () async throws -> () "
150
188
)
@@ -170,7 +208,10 @@ final class AsyncTests: XCTestCase {
170
208
assertParse (
171
209
" let _ = [() throws 1️⃣async -> ()]() " ,
172
210
diagnostics: [
173
- DiagnosticSpec ( message: " 'async' must precede 'throws' " , fixIts: [ " move 'async' in front of 'throws' " ] )
211
+ DiagnosticSpec (
212
+ message: " 'async' must precede 'throws' " ,
213
+ fixIts: [ " move 'async' in front of 'throws' " ]
214
+ )
174
215
] ,
175
216
fixedSource: " let _ = [() async throws -> ()]() "
176
217
)
@@ -182,7 +223,10 @@ final class AsyncTests: XCTestCase {
182
223
let _ = [() -> 1️⃣async ()]()
183
224
""" ,
184
225
diagnostics: [
185
- DiagnosticSpec ( message: " 'async' must preceed '->' " , fixIts: [ " move 'async' in front of '->' " ] )
226
+ DiagnosticSpec (
227
+ message: " 'async' must preceed '->' " ,
228
+ fixIts: [ " move 'async' in front of '->' " ]
229
+ )
186
230
] ,
187
231
fixedSource: """
188
232
let _ = [() async -> ()]()
0 commit comments