@@ -104,7 +104,8 @@ final class CodableTests: XCTestCase {
104104 case value = " value "
105105 }
106106 }
107- """
107+ """ ,
108+ conformsTo: [ " Codable " : [ " Decodable " ] ]
108109 )
109110 }
110111
@@ -142,7 +143,8 @@ final class CodableTests: XCTestCase {
142143 case value = " value "
143144 }
144145 }
145- """
146+ """ ,
147+ conformsTo: [ " Codable " : [ " Encodable " ] ]
146148 )
147149 }
148150
@@ -173,7 +175,8 @@ final class CodableTests: XCTestCase {
173175 func encode(to encoder: Encoder) throws {
174176 }
175177 }
176- """
178+ """ ,
179+ conformsTo: [ " Codable " : [ ] ]
177180 )
178181 }
179182}
@@ -182,6 +185,9 @@ func assertMacroExpansion(
182185 _ originalSource: String ,
183186 expandedSource: String ,
184187 diagnostics: [ DiagnosticSpec ] = [ ] ,
188+ conformsTo conformanceMap: [ String : [ TypeSyntax ] ] = [
189+ " Codable " : [ " Decodable " , " Encodable " ]
190+ ] ,
185191 testModuleName: String = " TestModule " ,
186192 testFileName: String = " test.swift " ,
187193 indentationWidth: Trivia = . spaces( 4 ) ,
@@ -204,6 +210,7 @@ func assertMacroExpansion(
204210 " CodingKeys " : CodingKeys . self,
205211 " IgnoreCodingInitialized " : IgnoreCodingInitialized . self,
206212 ] ,
213+ conformsTo: conformanceMap,
207214 testModuleName: testModuleName, testFileName: testFileName,
208215 indentationWidth: indentationWidth,
209216 file: file, line: line
@@ -221,14 +228,9 @@ extension DiagnosticSpec {
221228 return . init(
222229 id: MessageID (
223230 domain: " SwiftSyntaxMacroExpansion " ,
224- id: " accessorMacroOnVariableWithMultipleBindings "
231+ id: " peerMacroOnVariableWithMultipleBindings "
225232 ) ,
226- message:
227- " swift-syntax applies macros syntactically and "
228- + " there is no way to represent a variable declaration "
229- + " with multiple bindings that have accessors syntactically. "
230- + " While the compiler allows this expansion, "
231- + " swift-syntax cannot represent it and thus disallows it. " ,
233+ message: " peer macro can only be applied to a single variable " ,
232234 line: line, column: column
233235 )
234236 }
0 commit comments