Skip to content

Commit db55d96

Browse files
authored
fix: fixed build failure with ExistentialAny upcoming feature (by @Midbin) (#34)
1 parent ad19d4d commit db55d96

13 files changed

Lines changed: 172 additions & 172 deletions

Sources/CodableMacroPlugin/Registration/Registrar.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ fileprivate extension InitializerDeclSyntax {
289289
let decoder: TokenSyntax = "decoder"
290290
let param = FunctionParameterSyntax(
291291
firstName: "from", secondName: decoder,
292-
type: IdentifierTypeSyntax(name: "Decoder")
292+
type: "any Decoder" as TypeSyntax
293293
)
294294

295295
let signature = FunctionSignatureSyntax(
@@ -329,7 +329,7 @@ fileprivate extension FunctionDeclSyntax {
329329
let encoder: TokenSyntax = "encoder"
330330
let param = FunctionParameterSyntax(
331331
firstName: "to", secondName: encoder,
332-
type: IdentifierTypeSyntax(name: "Encoder")
332+
type: "any Encoder" as TypeSyntax
333333
)
334334

335335
let signature = FunctionSignatureSyntax(

Tests/MetaCodableTests/CodableTests.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ final class CodableTests: XCTestCase {
5050
}
5151
5252
extension SomeCodable: Decodable {
53-
init(from decoder: Decoder) throws {
53+
init(from decoder: any Decoder) throws {
5454
let container = try decoder.container(keyedBy: CodingKeys.self)
5555
self.value = try container.decode(String.self, forKey: CodingKeys.value)
5656
}
5757
}
5858
5959
extension SomeCodable: Encodable {
60-
func encode(to encoder: Encoder) throws {
60+
func encode(to encoder: any Encoder) throws {
6161
var container = encoder.container(keyedBy: CodingKeys.self)
6262
try container.encode(self.value, forKey: CodingKeys.value)
6363
}
@@ -79,7 +79,7 @@ final class CodableTests: XCTestCase {
7979
struct SomeCodable: Encodable {
8080
let value: String
8181
82-
func encode(to encoder: Encoder) throws {
82+
func encode(to encoder: any Encoder) throws {
8383
}
8484
}
8585
""",
@@ -88,12 +88,12 @@ final class CodableTests: XCTestCase {
8888
struct SomeCodable: Encodable {
8989
let value: String
9090
91-
func encode(to encoder: Encoder) throws {
91+
func encode(to encoder: any Encoder) throws {
9292
}
9393
}
9494
9595
extension SomeCodable: Decodable {
96-
init(from decoder: Decoder) throws {
96+
init(from decoder: any Decoder) throws {
9797
let container = try decoder.container(keyedBy: CodingKeys.self)
9898
self.value = try container.decode(String.self, forKey: CodingKeys.value)
9999
}
@@ -116,7 +116,7 @@ final class CodableTests: XCTestCase {
116116
struct SomeCodable: Decodable {
117117
let value: String
118118
119-
init(from decoder: Decoder) throws {
119+
init(from decoder: any Decoder) throws {
120120
self.value = "some"
121121
}
122122
}
@@ -126,13 +126,13 @@ final class CodableTests: XCTestCase {
126126
struct SomeCodable: Decodable {
127127
let value: String
128128
129-
init(from decoder: Decoder) throws {
129+
init(from decoder: any Decoder) throws {
130130
self.value = "some"
131131
}
132132
}
133133
134134
extension SomeCodable: Encodable {
135-
func encode(to encoder: Encoder) throws {
135+
func encode(to encoder: any Encoder) throws {
136136
var container = encoder.container(keyedBy: CodingKeys.self)
137137
try container.encode(self.value, forKey: CodingKeys.value)
138138
}
@@ -155,11 +155,11 @@ final class CodableTests: XCTestCase {
155155
struct SomeCodable: Codable {
156156
let value: String
157157
158-
init(from decoder: Decoder) throws {
158+
init(from decoder: any Decoder) throws {
159159
self.value = "some"
160160
}
161161
162-
func encode(to encoder: Encoder) throws {
162+
func encode(to encoder: any Encoder) throws {
163163
}
164164
}
165165
""",
@@ -168,11 +168,11 @@ final class CodableTests: XCTestCase {
168168
struct SomeCodable: Codable {
169169
let value: String
170170
171-
init(from decoder: Decoder) throws {
171+
init(from decoder: any Decoder) throws {
172172
self.value = "some"
173173
}
174174
175-
func encode(to encoder: Encoder) throws {
175+
func encode(to encoder: any Encoder) throws {
176176
}
177177
}
178178
""",

Tests/MetaCodableTests/CodedAtTests.swift

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ final class CodedAtTests: XCTestCase {
153153
}
154154
155155
extension SomeCodable: Decodable {
156-
init(from decoder: Decoder) throws {
156+
init(from decoder: any Decoder) throws {
157157
self.value = try String(from: decoder)
158158
}
159159
}
160160
161161
extension SomeCodable: Encodable {
162-
func encode(to encoder: Encoder) throws {
162+
func encode(to encoder: any Encoder) throws {
163163
try self.value.encode(to: encoder)
164164
}
165165
}
@@ -194,7 +194,7 @@ final class CodedAtTests: XCTestCase {
194194
}
195195
196196
extension SomeCodable: Decodable {
197-
init(from decoder: Decoder) throws {
197+
init(from decoder: any Decoder) throws {
198198
do {
199199
self.value = try String(from: decoder)
200200
} catch {
@@ -204,7 +204,7 @@ final class CodedAtTests: XCTestCase {
204204
}
205205
206206
extension SomeCodable: Encodable {
207-
func encode(to encoder: Encoder) throws {
207+
func encode(to encoder: any Encoder) throws {
208208
try self.value.encode(to: encoder)
209209
}
210210
}
@@ -239,13 +239,13 @@ final class CodedAtTests: XCTestCase {
239239
}
240240
241241
extension SomeCodable: Decodable {
242-
init(from decoder: Decoder) throws {
242+
init(from decoder: any Decoder) throws {
243243
self.value = try LossySequenceCoder<[String]>().decode(from: decoder)
244244
}
245245
}
246246
247247
extension SomeCodable: Encodable {
248-
func encode(to encoder: Encoder) throws {
248+
func encode(to encoder: any Encoder) throws {
249249
try LossySequenceCoder<[String]>().encode(self.value, to: encoder)
250250
}
251251
}
@@ -281,7 +281,7 @@ final class CodedAtTests: XCTestCase {
281281
}
282282
283283
extension SomeCodable: Decodable {
284-
init(from decoder: Decoder) throws {
284+
init(from decoder: any Decoder) throws {
285285
do {
286286
self.value = try LossySequenceCoder<[String]>().decode(from: decoder)
287287
} catch {
@@ -291,7 +291,7 @@ final class CodedAtTests: XCTestCase {
291291
}
292292
293293
extension SomeCodable: Encodable {
294-
func encode(to encoder: Encoder) throws {
294+
func encode(to encoder: any Encoder) throws {
295295
try LossySequenceCoder<[String]>().encode(self.value, to: encoder)
296296
}
297297
}
@@ -325,14 +325,14 @@ final class CodedAtTests: XCTestCase {
325325
}
326326
327327
extension SomeCodable: Decodable {
328-
init(from decoder: Decoder) throws {
328+
init(from decoder: any Decoder) throws {
329329
let container = try decoder.container(keyedBy: CodingKeys.self)
330330
self.value = try container.decode(String.self, forKey: CodingKeys.value)
331331
}
332332
}
333333
334334
extension SomeCodable: Encodable {
335-
func encode(to encoder: Encoder) throws {
335+
func encode(to encoder: any Encoder) throws {
336336
var container = encoder.container(keyedBy: CodingKeys.self)
337337
try container.encode(self.value, forKey: CodingKeys.value)
338338
}
@@ -369,7 +369,7 @@ final class CodedAtTests: XCTestCase {
369369
}
370370
371371
extension SomeCodable: Decodable {
372-
init(from decoder: Decoder) throws {
372+
init(from decoder: any Decoder) throws {
373373
let container = try decoder.container(keyedBy: CodingKeys.self)
374374
do {
375375
self.value = try container.decode(String.self, forKey: CodingKeys.value)
@@ -380,7 +380,7 @@ final class CodedAtTests: XCTestCase {
380380
}
381381
382382
extension SomeCodable: Encodable {
383-
func encode(to encoder: Encoder) throws {
383+
func encode(to encoder: any Encoder) throws {
384384
var container = encoder.container(keyedBy: CodingKeys.self)
385385
try container.encode(self.value, forKey: CodingKeys.value)
386386
}
@@ -417,14 +417,14 @@ final class CodedAtTests: XCTestCase {
417417
}
418418
419419
extension SomeCodable: Decodable {
420-
init(from decoder: Decoder) throws {
420+
init(from decoder: any Decoder) throws {
421421
let container = try decoder.container(keyedBy: CodingKeys.self)
422422
self.value = try LossySequenceCoder<[String]>().decode(from: container, forKey: CodingKeys.value)
423423
}
424424
}
425425
426426
extension SomeCodable: Encodable {
427-
func encode(to encoder: Encoder) throws {
427+
func encode(to encoder: any Encoder) throws {
428428
var container = encoder.container(keyedBy: CodingKeys.self)
429429
try LossySequenceCoder<[String]>().encode(self.value, to: &container, atKey: CodingKeys.value)
430430
}
@@ -462,7 +462,7 @@ final class CodedAtTests: XCTestCase {
462462
}
463463
464464
extension SomeCodable: Decodable {
465-
init(from decoder: Decoder) throws {
465+
init(from decoder: any Decoder) throws {
466466
let container = try decoder.container(keyedBy: CodingKeys.self)
467467
do {
468468
self.value = try LossySequenceCoder<[String]>().decode(from: container, forKey: CodingKeys.value)
@@ -473,7 +473,7 @@ final class CodedAtTests: XCTestCase {
473473
}
474474
475475
extension SomeCodable: Encodable {
476-
func encode(to encoder: Encoder) throws {
476+
func encode(to encoder: any Encoder) throws {
477477
var container = encoder.container(keyedBy: CodingKeys.self)
478478
try LossySequenceCoder<[String]>().encode(self.value, to: &container, atKey: CodingKeys.value)
479479
}
@@ -509,7 +509,7 @@ final class CodedAtTests: XCTestCase {
509509
}
510510
511511
extension SomeCodable: Decodable {
512-
init(from decoder: Decoder) throws {
512+
init(from decoder: any Decoder) throws {
513513
let container = try decoder.container(keyedBy: CodingKeys.self)
514514
let deeply_container = try container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
515515
let nested_deeply_container = try deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
@@ -518,7 +518,7 @@ final class CodedAtTests: XCTestCase {
518518
}
519519
520520
extension SomeCodable: Encodable {
521-
func encode(to encoder: Encoder) throws {
521+
func encode(to encoder: any Encoder) throws {
522522
var container = encoder.container(keyedBy: CodingKeys.self)
523523
var deeply_container = container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
524524
var nested_deeply_container = deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
@@ -559,7 +559,7 @@ final class CodedAtTests: XCTestCase {
559559
}
560560
561561
extension SomeCodable: Decodable {
562-
init(from decoder: Decoder) throws {
562+
init(from decoder: any Decoder) throws {
563563
let container = try decoder.container(keyedBy: CodingKeys.self)
564564
let deeply_container = try container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
565565
let nested_deeply_container = try deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
@@ -572,7 +572,7 @@ final class CodedAtTests: XCTestCase {
572572
}
573573
574574
extension SomeCodable: Encodable {
575-
func encode(to encoder: Encoder) throws {
575+
func encode(to encoder: any Encoder) throws {
576576
var container = encoder.container(keyedBy: CodingKeys.self)
577577
var deeply_container = container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
578578
var nested_deeply_container = deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
@@ -613,7 +613,7 @@ final class CodedAtTests: XCTestCase {
613613
}
614614
615615
extension SomeCodable: Decodable {
616-
init(from decoder: Decoder) throws {
616+
init(from decoder: any Decoder) throws {
617617
let container = try decoder.container(keyedBy: CodingKeys.self)
618618
let deeply_container = try container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
619619
let nested_deeply_container = try deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
@@ -622,7 +622,7 @@ final class CodedAtTests: XCTestCase {
622622
}
623623
624624
extension SomeCodable: Encodable {
625-
func encode(to encoder: Encoder) throws {
625+
func encode(to encoder: any Encoder) throws {
626626
var container = encoder.container(keyedBy: CodingKeys.self)
627627
var deeply_container = container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
628628
var nested_deeply_container = deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
@@ -664,7 +664,7 @@ final class CodedAtTests: XCTestCase {
664664
}
665665
666666
extension SomeCodable: Decodable {
667-
init(from decoder: Decoder) throws {
667+
init(from decoder: any Decoder) throws {
668668
let container = try decoder.container(keyedBy: CodingKeys.self)
669669
let deeply_container = try container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
670670
let nested_deeply_container = try deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
@@ -677,7 +677,7 @@ final class CodedAtTests: XCTestCase {
677677
}
678678
679679
extension SomeCodable: Encodable {
680-
func encode(to encoder: Encoder) throws {
680+
func encode(to encoder: any Encoder) throws {
681681
var container = encoder.container(keyedBy: CodingKeys.self)
682682
var deeply_container = container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
683683
var nested_deeply_container = deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)

0 commit comments

Comments
 (0)