@@ -24,7 +24,7 @@ final class MacroReplacementTests: XCTestCase {
24
24
macro expand1(a: Int, b: Int) = #otherMacro(first: b, second: [ " a " : a], third: [3.14159, 2.71828], fourth: 4)
25
25
"""
26
26
27
- let definition = try macro. as ( MacroDeclSyntax . self) ! . checkDefinition ( )
27
+ let definition = try macro. cast ( MacroDeclSyntax . self) . checkDefinition ( )
28
28
guard case let . expansion( _, replacements, _) = definition else {
29
29
XCTFail ( " not an expansion definition " )
30
30
fatalError ( )
@@ -43,7 +43,7 @@ final class MacroReplacementTests: XCTestCase {
43
43
44
44
let diags : [ Diagnostic ]
45
45
do {
46
- _ = try macro. as ( MacroDeclSyntax . self) ! . checkDefinition ( )
46
+ _ = try macro. cast ( MacroDeclSyntax . self) . checkDefinition ( )
47
47
XCTFail ( " should have failed with an error " )
48
48
fatalError ( )
49
49
} catch let diagError as DiagnosticsError {
@@ -69,7 +69,7 @@ final class MacroReplacementTests: XCTestCase {
69
69
70
70
let diags : [ Diagnostic ]
71
71
do {
72
- _ = try macro. as ( MacroDeclSyntax . self) ! . checkDefinition ( )
72
+ _ = try macro. cast ( MacroDeclSyntax . self) . checkDefinition ( )
73
73
XCTFail ( " should have failed with an error " )
74
74
fatalError ( )
75
75
} catch let diagError as DiagnosticsError {
@@ -94,7 +94,7 @@ final class MacroReplacementTests: XCTestCase {
94
94
#expand1(a: 5, b: 17)
95
95
"""
96
96
97
- let macroDecl = macro. as ( MacroDeclSyntax . self) !
97
+ let macroDecl = macro. cast ( MacroDeclSyntax . self)
98
98
let definition = try macroDecl. checkDefinition ( )
99
99
guard case let . expansion( expansion, replacements, genericReplacements) = definition else {
100
100
XCTFail ( " not a normal expansion " )
@@ -115,7 +115,7 @@ final class MacroReplacementTests: XCTestCase {
115
115
)
116
116
}
117
117
118
- func testMacroGenericArgumentExpansion_base ( ) throws {
118
+ func testMacroGenericArgumentExpansionBase ( ) throws {
119
119
let macro : DeclSyntax =
120
120
"""
121
121
macro gen<A, B>(a: A, b: B) = #otherMacro<A, B>(first: a, second: b)
@@ -126,7 +126,7 @@ final class MacroReplacementTests: XCTestCase {
126
126
#gen<Int, String>(a: 5, b: " Hello " )
127
127
"""
128
128
129
- let macroDecl = macro. as ( MacroDeclSyntax . self) !
129
+ let macroDecl = macro. cast ( MacroDeclSyntax . self)
130
130
let definition = try macroDecl. checkDefinition ( )
131
131
guard case let . expansion( expansion, replacements, genericReplacements) = definition else {
132
132
XCTFail ( " not a normal expansion " )
@@ -158,7 +158,7 @@ final class MacroReplacementTests: XCTestCase {
158
158
)
159
159
}
160
160
161
- func testMacroGenericArgumentExpansion_ignoreTrivia ( ) throws {
161
+ func testMacroGenericArgumentExpansionIgnoreTrivia ( ) throws {
162
162
let macro : DeclSyntax =
163
163
"""
164
164
macro gen<A, B /* some comment */>(a: A, b: B) = #otherMacro<A, B>(first: a, second: b)
@@ -169,7 +169,7 @@ final class MacroReplacementTests: XCTestCase {
169
169
#gen<Int, String>(a: 5, b: " Hello " )
170
170
"""
171
171
172
- let macroDecl = macro. as ( MacroDeclSyntax . self) !
172
+ let macroDecl = macro. cast ( MacroDeclSyntax . self)
173
173
let definition = try macroDecl. checkDefinition ( )
174
174
guard case let . expansion( expansion, replacements, genericReplacements) = definition else {
175
175
XCTFail ( " not a normal expansion " )
@@ -200,7 +200,7 @@ final class MacroReplacementTests: XCTestCase {
200
200
)
201
201
}
202
202
203
- func testMacroGenericArgumentExpansion_notVisitGenericParameterArguments ( ) throws {
203
+ func testMacroGenericArgumentExpansionNotVisitGenericParameterArguments ( ) throws {
204
204
let macro : DeclSyntax =
205
205
"""
206
206
macro gen(a: Array<Int>) = #otherMacro(first: a)
@@ -211,7 +211,7 @@ final class MacroReplacementTests: XCTestCase {
211
211
#gen(a: [1, 2, 3])
212
212
"""
213
213
214
- let macroDecl = macro. as ( MacroDeclSyntax . self) !
214
+ let macroDecl = macro. cast ( MacroDeclSyntax . self)
215
215
let definition = try macroDecl. checkDefinition ( )
216
216
guard case let . expansion( expansion, replacements, genericReplacements) = definition else {
217
217
XCTFail ( " not a normal expansion " )
@@ -234,7 +234,7 @@ final class MacroReplacementTests: XCTestCase {
234
234
)
235
235
}
236
236
237
- func testMacroGenericArgumentExpansion_replaceInner ( ) throws {
237
+ func testMacroGenericArgumentExpansionReplaceInner ( ) throws {
238
238
let macro : DeclSyntax =
239
239
"""
240
240
macro gen<A>(a: Array<A>) = #reduce<A>(first: a)
@@ -245,7 +245,7 @@ final class MacroReplacementTests: XCTestCase {
245
245
#gen<Int>(a: [1, 2, 3])
246
246
"""
247
247
248
- let macroDecl = macro. as ( MacroDeclSyntax . self) !
248
+ let macroDecl = macro. cast ( MacroDeclSyntax . self)
249
249
let definition = try macroDecl. checkDefinition ( )
250
250
guard case let . expansion( expansion, replacements, genericReplacements) = definition else {
251
251
XCTFail ( " not a normal expansion " )
@@ -268,18 +268,18 @@ final class MacroReplacementTests: XCTestCase {
268
268
)
269
269
}
270
270
271
- func testMacroGenericArgumentExpansion_array ( ) throws {
271
+ func testMacroGenericArgumentExpansionArray ( ) throws {
272
272
let macro : DeclSyntax =
273
273
"""
274
274
macro gen(a: Array<Int>) = #other<A>(first: a)
275
275
"""
276
276
277
277
let use : ExprSyntax =
278
278
"""
279
- #otheren <Int>(a: [1, 2, 3])
279
+ #gen <Int>(a: [1, 2, 3])
280
280
"""
281
281
282
- let macroDecl = macro. as ( MacroDeclSyntax . self) !
282
+ let macroDecl = macro. cast ( MacroDeclSyntax . self)
283
283
let definition = try macroDecl. checkDefinition ( )
284
284
guard case let . expansion( expansion, replacements, genericReplacements) = definition else {
285
285
XCTFail ( " not a normal expansion " )
@@ -302,18 +302,18 @@ final class MacroReplacementTests: XCTestCase {
302
302
)
303
303
}
304
304
305
- func testMacroExpansion_dontCrashOnDuplicates ( ) throws {
305
+ func testMacroExpansionDontCrashOnDuplicates ( ) throws {
306
306
let macro : DeclSyntax =
307
307
"""
308
308
macro gen(a: Array<Int>) = #other<A>(first: a)
309
309
"""
310
310
311
311
let use : ExprSyntax =
312
312
"""
313
- #otheren <Int>(a: [1, 2, 3])
313
+ #gen <Int>(a: [1, 2, 3])
314
314
"""
315
315
316
- let macroDecl = macro. as ( MacroDeclSyntax . self) !
316
+ let macroDecl = macro. cast ( MacroDeclSyntax . self)
317
317
let definition = try macroDecl. checkDefinition ( )
318
318
guard case let . expansion( expansion, replacements, genericReplacements) = definition else {
319
319
XCTFail ( " not a normal expansion " )
0 commit comments