You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// CHECK-DIAGS: CONTENTS OF FILE @__swiftmacro_9MacroUser3Bad7InvalidfMp_.swift
109
114
// CHECK-DIAGS: import Swift
@@ -132,21 +137,28 @@ struct Bad {}
132
137
133
138
class HasStoredPropertyClassInvalid {
134
139
#AddStoredProperty((Self.self,0).1) // expected-note {{in expansion of macro 'AddStoredProperty' here}}
135
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX[[@LINE-2]]_2_33_{{.*}}AddStoredPropertyfMf_.swift:1:22: error: covariant 'Self' type cannot be referenced from a stored property initializer
140
+
/*
141
+
expected-expansion@-2:3 {{
142
+
expected-error@1:22{{covariant 'Self' type cannot be referenced from a stored property initializer}}
143
+
}}
144
+
*/
136
145
}
137
146
138
147
// Redeclaration checking should behave as though expansions are part of the
// expected-error@+1 {{invalid redeclaration of 'value'}}
144
158
varvalue:Int{0}
145
159
}
146
160
147
-
// CHECK-DIAGS: macro_expand.swift:[[@LINE-3]]:7: error: invalid redeclaration of 'value'
148
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX[[@LINE-8]]_2_33_4361AD9339943F52AE6186DD51E04E91Ll8varValuefMf_.swift:1:5: note: 'value' previously declared here
149
-
// CHECK-DIAGS: CONTENTS OF FILE @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX[[@LINE-9]]_2_33_4361AD9339943F52AE6186DD51E04E91Ll8varValuefMf_.swift:
161
+
// CHECK-DIAGS: CONTENTS OF FILE @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX[[@LINE-12]]_2_33_4361AD9339943F52AE6186DD51E04E91Ll8varValuefMf_.swift:
150
162
// CHECK-DIAGS: var value: Int {
151
163
// CHECK-DIAGS: 1
152
164
// CHECK-DIAGS: }
@@ -159,11 +171,19 @@ public macro ThrowCancellation() = #externalMacro(module: "MacroDefinition", typ
159
171
// error mismatch.
160
172
@ThrowCancellation // expected-note {{in expansion of macro 'ThrowCancellation' on global function 'issue79039()' here}}
161
173
func issue79039()throws(DecodingError)
162
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser10issue7903917ThrowCancellationfMb_.swift:2:11: error: thrown expression type 'CancellationError' cannot be converted to error type 'DecodingError'
174
+
/*
175
+
expected-expansion@-2:39 {{
176
+
expected-error@2:11{{thrown expression type 'CancellationError' cannot be converted to error type 'DecodingError'}}
177
+
}}
178
+
*/
163
179
164
180
@ThrowCancellation // expected-note {{in expansion of macro 'ThrowCancellation' on global function 'issue79039_2()' here}}
165
181
func issue79039_2()throws(DecodingError){}
166
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser12issue79039_217ThrowCancellationfMb_.swift:2:11: error: thrown expression type 'CancellationError' cannot be converted to error type 'DecodingError'
182
+
/*
183
+
expected-expansion@-2:43 {{
184
+
expected-error@2:11{{thrown expression type 'CancellationError' cannot be converted to error type 'DecodingError'}}
// expected-note@-1 {{in expansion of macro 'accidentalCodeItem' here}}
179
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX[[@LINE-3]]_2_18accidentalCodeItemfMf_.swift:1:1: error: expected macro expansion to produce a declaration
199
+
/*
200
+
expected-expansion@-3:3 {{
201
+
expected-error@1:1{{expected macro expansion to produce a declaration}}
202
+
}}
203
+
*/
180
204
181
205
@AccidentalCodeItemstructS{}
182
206
// expected-note@-1 {{in expansion of macro 'AccidentalCodeItem' on struct 'S' here}}
183
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser018invalidDeclarationA0yyF5S_$l018AccidentalCodeItemfMp_.swift:1:1: error: expected macro expansion to produce a declaration
207
+
/*
208
+
expected-expansion@-3:34 {{
209
+
expected-error@1:1{{expected macro expansion to produce a declaration}}
210
+
}}
211
+
*/
184
212
185
213
do{
186
214
@AccidentalCodeItemstructS{}
187
215
// expected-note@-1 {{in expansion of macro 'AccidentalCodeItem' on struct 'S' here}}
188
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser018invalidDeclarationA0yyF5S_$l118AccidentalCodeItemfMp_.swift:1:1: error: expected macro expansion to produce a declaration
216
+
/*
217
+
expected-expansion@-3:36 {{
218
+
expected-error@1:1{{expected macro expansion to produce a declaration}}
219
+
}}
220
+
*/
189
221
}
190
222
}
191
223
#endif
@@ -323,9 +355,14 @@ func testNested() {
323
355
structNested{}
324
356
_ = #stringify(#assertAny(Nested()))
325
357
// expected-note@-1 {{in expansion of macro 'stringify' here}}
326
-
// CHECK-DIAGS-NOT: error: cannot convert value of type 'Nested' to expected argument type 'Bool'
327
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_9stringifyfMf_9assertAnyfMf_.swift:1:8: error: cannot convert value of type 'Nested' to expected argument type 'Bool'
328
-
// CHECK-DIAGS-NOT: error: cannot convert value of type 'Nested' to expected argument type 'Bool'
358
+
/*
359
+
expected-expansion@-3:7 {{
360
+
expected-note@1:2{{in expansion of macro 'assertAny' here}}
361
+
expected-expansion@1:2{{
362
+
expected-error@1:8{{cannot convert value of type 'Nested' to expected argument type 'Bool'}}
363
+
}}
364
+
}}
365
+
*/
329
366
330
367
// PRETTY-DIAGS: 1:8: error: cannot convert value of type 'Nested' to expected argument type 'Bool'
331
368
// PRETTY-DIAGS: macro_expand.swift:{{.*}}:39: note: expanded code originates here
expected-error@1:2{{call can throw but is not marked with 'try'}}
387
+
expected-note@1:2{{did you mean to disable error propagation?}}
388
+
expected-note@1:2{{did you mean to handle error as optional value?}}
389
+
expected-note@1:2{{did you mean to use 'try'?}}
390
+
}}
391
+
*/
347
392
348
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX{{.*}}_9stringifyfMf1_.swift:1:2: error: call can throw but is not marked with 'try'
// expected-note@-1 {{in expansion of macro 'accidentalCodeItem' here}}
762
-
// CHECK-DIAGS: @__swiftmacro_9MacroUser0023macro_expandswift_elFCffMX[[@LINE-3]]_6_18accidentalCodeItemfMf_.swift:1:1: error: expected macro expansion to produce a declaration
829
+
/*
830
+
expected-expansion@-3:7 {{
831
+
expected-error@1:1{{expected macro expansion to produce a declaration}}
0 commit comments