Skip to content

Commit

Permalink
fix: fixed build failure with ExistentialAny upcoming feature (by @…
Browse files Browse the repository at this point in the history
  • Loading branch information
Midbin committed Nov 6, 2023
1 parent ad19d4d commit db55d96
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 172 deletions.
4 changes: 2 additions & 2 deletions Sources/CodableMacroPlugin/Registration/Registrar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ fileprivate extension InitializerDeclSyntax {
let decoder: TokenSyntax = "decoder"
let param = FunctionParameterSyntax(
firstName: "from", secondName: decoder,
type: IdentifierTypeSyntax(name: "Decoder")
type: "any Decoder" as TypeSyntax
)

let signature = FunctionSignatureSyntax(
Expand Down Expand Up @@ -329,7 +329,7 @@ fileprivate extension FunctionDeclSyntax {
let encoder: TokenSyntax = "encoder"
let param = FunctionParameterSyntax(
firstName: "to", secondName: encoder,
type: IdentifierTypeSyntax(name: "Encoder")
type: "any Encoder" as TypeSyntax
)

let signature = FunctionSignatureSyntax(
Expand Down
24 changes: 12 additions & 12 deletions Tests/MetaCodableTests/CodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ final class CodableTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.value = try container.decode(String.self, forKey: CodingKeys.value)
}
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.value, forKey: CodingKeys.value)
}
Expand All @@ -79,7 +79,7 @@ final class CodableTests: XCTestCase {
struct SomeCodable: Encodable {
let value: String
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
}
}
""",
Expand All @@ -88,12 +88,12 @@ final class CodableTests: XCTestCase {
struct SomeCodable: Encodable {
let value: String
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
}
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.value = try container.decode(String.self, forKey: CodingKeys.value)
}
Expand All @@ -116,7 +116,7 @@ final class CodableTests: XCTestCase {
struct SomeCodable: Decodable {
let value: String
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
self.value = "some"
}
}
Expand All @@ -126,13 +126,13 @@ final class CodableTests: XCTestCase {
struct SomeCodable: Decodable {
let value: String
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
self.value = "some"
}
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.value, forKey: CodingKeys.value)
}
Expand All @@ -155,11 +155,11 @@ final class CodableTests: XCTestCase {
struct SomeCodable: Codable {
let value: String
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
self.value = "some"
}
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
}
}
""",
Expand All @@ -168,11 +168,11 @@ final class CodableTests: XCTestCase {
struct SomeCodable: Codable {
let value: String
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
self.value = "some"
}
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
}
}
""",
Expand Down
48 changes: 24 additions & 24 deletions Tests/MetaCodableTests/CodedAtTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
self.value = try String(from: decoder)
}
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
try self.value.encode(to: encoder)
}
}
Expand Down Expand Up @@ -194,7 +194,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
do {
self.value = try String(from: decoder)
} catch {
Expand All @@ -204,7 +204,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
try self.value.encode(to: encoder)
}
}
Expand Down Expand Up @@ -239,13 +239,13 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
self.value = try LossySequenceCoder<[String]>().decode(from: decoder)
}
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
try LossySequenceCoder<[String]>().encode(self.value, to: encoder)
}
}
Expand Down Expand Up @@ -281,7 +281,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
do {
self.value = try LossySequenceCoder<[String]>().decode(from: decoder)
} catch {
Expand All @@ -291,7 +291,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
try LossySequenceCoder<[String]>().encode(self.value, to: encoder)
}
}
Expand Down Expand Up @@ -325,14 +325,14 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.value = try container.decode(String.self, forKey: CodingKeys.value)
}
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.value, forKey: CodingKeys.value)
}
Expand Down Expand Up @@ -369,7 +369,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
do {
self.value = try container.decode(String.self, forKey: CodingKeys.value)
Expand All @@ -380,7 +380,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.value, forKey: CodingKeys.value)
}
Expand Down Expand Up @@ -417,14 +417,14 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.value = try LossySequenceCoder<[String]>().decode(from: container, forKey: CodingKeys.value)
}
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try LossySequenceCoder<[String]>().encode(self.value, to: &container, atKey: CodingKeys.value)
}
Expand Down Expand Up @@ -462,7 +462,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
do {
self.value = try LossySequenceCoder<[String]>().decode(from: container, forKey: CodingKeys.value)
Expand All @@ -473,7 +473,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try LossySequenceCoder<[String]>().encode(self.value, to: &container, atKey: CodingKeys.value)
}
Expand Down Expand Up @@ -509,7 +509,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let deeply_container = try container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
let nested_deeply_container = try deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
Expand All @@ -518,7 +518,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
var deeply_container = container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
var nested_deeply_container = deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
Expand Down Expand Up @@ -559,7 +559,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let deeply_container = try container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
let nested_deeply_container = try deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
Expand All @@ -572,7 +572,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
var deeply_container = container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
var nested_deeply_container = deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
Expand Down Expand Up @@ -613,7 +613,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let deeply_container = try container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
let nested_deeply_container = try deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
Expand All @@ -622,7 +622,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
var deeply_container = container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
var nested_deeply_container = deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
Expand Down Expand Up @@ -664,7 +664,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Decodable {
init(from decoder: Decoder) throws {
init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let deeply_container = try container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
let nested_deeply_container = try deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
Expand All @@ -677,7 +677,7 @@ final class CodedAtTests: XCTestCase {
}
extension SomeCodable: Encodable {
func encode(to encoder: Encoder) throws {
func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
var deeply_container = container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.deeply)
var nested_deeply_container = deeply_container.nestedContainer(keyedBy: CodingKeys.self, forKey: CodingKeys.nested)
Expand Down

0 comments on commit db55d96

Please sign in to comment.