@@ -130,13 +130,16 @@ final class MacroReplacementTests: XCTestCase {
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 " )
133
- fatalError ( )
133
+ return
134
134
}
135
135
136
136
let replacementA = try XCTUnwrap ( genericReplacements. first)
137
- guard let replacementB = genericReplacements. dropFirst ( ) . first else {
138
137
XCTFail ( " Expected generic replacement for A " )
139
- fatalError ( )
138
+ return
139
+ }
140
+ guard let replacementB = genericReplacements. dropFirst ( ) . first else {
141
+ XCTFail ( " Expected generic replacement for B " )
142
+ return
140
143
}
141
144
XCTAssertEqual( genericReplacements. count, 2 )
142
145
@@ -159,4 +162,38 @@ final class MacroReplacementTests: XCTestCase {
159
162
"""
160
163
)
161
164
}
165
+
166
+ func testMacroGenericArgumentExpansion_notVisitGenericParameterArguments( ) throws {
167
+ let macro : DeclSyntax =
168
+ """
169
+ macro gen(a: Array<Int>) = #otherMacro(first: a)
170
+ """
171
+
172
+ let use : ExprSyntax =
173
+ """
174
+ #gen(a: [1, 2, 3])
175
+ """
176
+
177
+ let macroDecl = macro. as ( MacroDeclSyntax . self) !
178
+ let definition = try macroDecl. checkDefinition ( )
179
+ guard case let . expansion( expansion, replacements, genericReplacements) = definition else {
180
+ XCTFail ( " not a normal expansion " )
181
+ return
182
+ }
183
+
184
+ XCTAssertEqual ( genericReplacements. count, 0 )
185
+
186
+ let expandedSyntax = macroDecl. expand (
187
+ use. as ( MacroExpansionExprSyntax . self) !,
188
+ definition: expansion,
189
+ replacements: replacements,
190
+ genericReplacements: genericReplacements
191
+ )
192
+ assertStringsEqualWithDiff (
193
+ expandedSyntax. description,
194
+ """
195
+ #otherMacro(first: [1, 2, 3])
196
+ """
197
+ )
198
+ }
162
199
}
0 commit comments