From dcfe2c0839691730e427ad78350182a7afa9669e Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Thu, 27 Aug 2026 13:31:19 -0700 Subject: [PATCH 1/2] Adopt `CasePath` protocol This upcoming protocol allows for better compatibility between CasePaths 1.0 and the upcoming 2.0. --- Package.resolved | 11 +++++++++- Package.swift | 3 ++- Sources/Sharing/Traits/CasePaths.swift | 28 +++++++++++++------------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Package.resolved b/Package.resolved index 5225cb5..7a8a585 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "62d09cddc4ab84131cb5e2cef0a442b1197e705e7023b538a05462a3e113a8f4", + "originHash" : "d0ec5dd6e970c0cb660b8708c1dd69993010ca4abf507cd10887fcc95907d8c0", "pins" : [ { "identity" : "combine-schedulers", @@ -10,6 +10,15 @@ "version" : "1.2.0" } }, + { + "identity" : "swift-case-paths", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-case-paths", + "state" : { + "branch" : "macro-spec", + "revision" : "cdfbedad1014028667110642217fc731495be0ad" + } + }, { "identity" : "swift-clocks", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index c2b8cc7..220ce59 100644 --- a/Package.swift +++ b/Package.swift @@ -33,7 +33,8 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/pointfreeco/combine-schedulers", from: "1.0.0"), - .package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.7.3"), + // .package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.10.0"), + .package(url: "https://github.com/pointfreeco/swift-case-paths", branch: "macro-spec"), .package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.3.0"), .package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.0.0"), .package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.5.1"), diff --git a/Sources/Sharing/Traits/CasePaths.swift b/Sources/Sharing/Traits/CasePaths.swift index 26540e2..d4d93c5 100644 --- a/Sources/Sharing/Traits/CasePaths.swift +++ b/Sources/Sharing/Traits/CasePaths.swift @@ -8,7 +8,7 @@ extension Shared { @_disfavoredOverload public subscript( - dynamicMember keyPath: KeyPath> + dynamicMember keyPath: KeyPath & Sendable> ) -> Shared? where Value: CasePathable { func open(_ reference: some MutableReference) -> Shared { @@ -24,7 +24,7 @@ extension SharedReader { @_disfavoredOverload public subscript( - dynamicMember keyPath: KeyPath> + dynamicMember keyPath: KeyPath & Sendable> ) -> SharedReader? where Value: CasePathable { func open(_ reference: some Reference) -> SharedReader { @@ -37,15 +37,15 @@ } } - private final class _ReferenceEnumToOptionalCase - where Base.Value: CasePathable { - typealias Value = Case? + private final class _ReferenceEnumToOptionalCase + where Base.Value: CasePathable, Path.Root == Base.Value { + typealias Value = Path.Value? let base: Base - let keyPath: _SendableKeyPath> - let casePath: AnyCasePath + let keyPath: _SendableKeyPath + let casePath: Path init( - base: Base, keyPath: _SendableKeyPath> + base: Base, keyPath: _SendableKeyPath ) { self.base = base self.keyPath = keyPath @@ -102,15 +102,15 @@ #endif } - private final class _MutableReferenceEnumToOptionalCase - where Base.Value: CasePathable { - typealias Value = Case? + private final class _MutableReferenceEnumToOptionalCase + where Base.Value: CasePathable, Path.Root == Base.Value { + typealias Value = Path.Value? let base: Base - let keyPath: _SendableKeyPath> - let casePath: AnyCasePath + let keyPath: _SendableKeyPath + let casePath: Path init( - base: Base, keyPath: _SendableKeyPath> + base: Base, keyPath: _SendableKeyPath ) { self.base = base self.keyPath = keyPath From e3310c6e3fc92cb100b4594742f947d87e80076d Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 31 Aug 2026 10:20:48 -0700 Subject: [PATCH 2/2] wip --- Package.resolved | 11 +---------- Package.swift | 3 +-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Package.resolved b/Package.resolved index 7a8a585..cfaade3 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "d0ec5dd6e970c0cb660b8708c1dd69993010ca4abf507cd10887fcc95907d8c0", + "originHash" : "7dc94e69ad7f7c30a8c98561b5ce744155c3a5bc4f529010d754bd2536ff2489", "pins" : [ { "identity" : "combine-schedulers", @@ -10,15 +10,6 @@ "version" : "1.2.0" } }, - { - "identity" : "swift-case-paths", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/swift-case-paths", - "state" : { - "branch" : "macro-spec", - "revision" : "cdfbedad1014028667110642217fc731495be0ad" - } - }, { "identity" : "swift-clocks", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index 220ce59..b7c057b 100644 --- a/Package.swift +++ b/Package.swift @@ -33,8 +33,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/pointfreeco/combine-schedulers", from: "1.0.0"), - // .package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.10.0"), - .package(url: "https://github.com/pointfreeco/swift-case-paths", branch: "macro-spec"), + .package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.10.0"), .package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.3.0"), .package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.0.0"), .package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.5.1"),