From cfe94883cc2bd26ebf8109054734aa1f9f4c701f Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Wed, 17 Feb 2021 23:00:36 -0800 Subject: [PATCH 1/6] don't bind on unused part of pattern match. --- .../Resource/Resource Object/ResourceObjectDecodingError.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/JSONAPI/Resource/Resource Object/ResourceObjectDecodingError.swift b/Sources/JSONAPI/Resource/Resource Object/ResourceObjectDecodingError.swift index 528f695..7ca4c04 100644 --- a/Sources/JSONAPI/Resource/Resource Object/ResourceObjectDecodingError.swift +++ b/Sources/JSONAPI/Resource/Resource Object/ResourceObjectDecodingError.swift @@ -77,7 +77,7 @@ public struct ResourceObjectDecodingError: Swift.Error, Equatable { init?(_ jsonAPIError: JSONAPICodingError, jsonAPIType: String) { self.resourceObjectJsonAPIType = jsonAPIType switch jsonAPIError { - case .typeMismatch(expected: let expected, found: let found, path: let path): + case .typeMismatch(expected: _, found: let found, path: let path): (location, subjectName) = Self.context(path: path) cause = .jsonTypeMismatch(foundType: found) case .quantityMismatch(expected: let expected, path: let path): From 160f67326c838ab539d764ed9dacf00d47407dc9 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Wed, 17 Feb 2021 23:02:17 -0800 Subject: [PATCH 2/6] add nightly swift 5.4 docker to CI --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4cd1974..b236eb3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,7 @@ jobs: - swift:5.3-focal - swift:5.3-centos8 - swift:5.3-amazonlinux2 + - swiftlang/swift:nightly-5.4-focal container: ${{ matrix.image }} steps: - name: Checkout code From 0f792996621fd845bf30f65d3e3db57cb0acc833 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Sat, 6 Mar 2021 15:58:54 -0800 Subject: [PATCH 3/6] see if its just the weirdness around the id name that is tripping the compiler up --- Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift b/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift index a9c10d8..beef565 100644 --- a/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift +++ b/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift @@ -167,8 +167,8 @@ extension ResourceObject: JSONAPIIdentifiable, IdentifiableResourceObjectType, R public typealias ID = ResourceObject.Id } -@available(OSX 10.15, iOS 13, tvOS 13, watchOS 6, *) -extension ResourceObject: Swift.Identifiable where EntityRawIdType: JSONAPI.RawIdType {} +//@available(OSX 10.15, iOS 13, tvOS 13, watchOS 6, *) +//extension ResourceObject: Swift.Identifiable where EntityRawIdType: JSONAPI.RawIdType {} extension ResourceObject: CustomStringConvertible { public var description: String { From 17a68c9741a712849ea77a768a2616791857f214 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Sat, 6 Mar 2021 16:01:58 -0800 Subject: [PATCH 4/6] Revert "see if its just the weirdness around the id name that is tripping the compiler up" This reverts commit 0f792996621fd845bf30f65d3e3db57cb0acc833. --- Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift b/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift index beef565..a9c10d8 100644 --- a/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift +++ b/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift @@ -167,8 +167,8 @@ extension ResourceObject: JSONAPIIdentifiable, IdentifiableResourceObjectType, R public typealias ID = ResourceObject.Id } -//@available(OSX 10.15, iOS 13, tvOS 13, watchOS 6, *) -//extension ResourceObject: Swift.Identifiable where EntityRawIdType: JSONAPI.RawIdType {} +@available(OSX 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension ResourceObject: Swift.Identifiable where EntityRawIdType: JSONAPI.RawIdType {} extension ResourceObject: CustomStringConvertible { public var description: String { From 87d43cc354d259209ec649930c3e0509e1574a8f Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Sat, 6 Mar 2021 16:02:19 -0800 Subject: [PATCH 5/6] See if using name explicitly helps. --- .../Resource/Resource Object/ResourceObject+Replacing.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/JSONAPI/Resource/Resource Object/ResourceObject+Replacing.swift b/Sources/JSONAPI/Resource/Resource Object/ResourceObject+Replacing.swift index 98ef37c..9960a86 100644 --- a/Sources/JSONAPI/Resource/Resource Object/ResourceObject+Replacing.swift +++ b/Sources/JSONAPI/Resource/Resource Object/ResourceObject+Replacing.swift @@ -15,7 +15,7 @@ public extension JSONAPI.ResourceObject { /// - parameters: /// - replacement: A function that takes the existing `attributes` and returns the replacement. func replacingAttributes(_ replacement: (Description.Attributes) -> Description.Attributes) -> Self { - return Self(id: id, + return ResourceObject(id: id, attributes: replacement(attributes), relationships: relationships, meta: meta, From a8c4bf67d8d84d99c60f9f01adca16d9567fe9ed Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Sat, 6 Mar 2021 16:10:42 -0800 Subject: [PATCH 6/6] revert Self -> ResourceObject change but also try swapping out a typealias reference that seems to be confusing to the compiler for the thing that typealias references. --- .../Resource/Resource Object/ResourceObject+Replacing.swift | 2 +- Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/JSONAPI/Resource/Resource Object/ResourceObject+Replacing.swift b/Sources/JSONAPI/Resource/Resource Object/ResourceObject+Replacing.swift index 9960a86..98ef37c 100644 --- a/Sources/JSONAPI/Resource/Resource Object/ResourceObject+Replacing.swift +++ b/Sources/JSONAPI/Resource/Resource Object/ResourceObject+Replacing.swift @@ -15,7 +15,7 @@ public extension JSONAPI.ResourceObject { /// - parameters: /// - replacement: A function that takes the existing `attributes` and returns the replacement. func replacingAttributes(_ replacement: (Description.Attributes) -> Description.Attributes) -> Self { - return ResourceObject(id: id, + return Self(id: id, attributes: replacement(attributes), relationships: relationships, meta: meta, diff --git a/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift b/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift index a9c10d8..77d367e 100644 --- a/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift +++ b/Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift @@ -128,7 +128,7 @@ public struct ResourceObject /// The JSON API compliant attributes of this `ResourceObject`. public let attributes: Description.Attributes