Skip to content

Commit 5a96a88

Browse files
committed
Add compiler version check for Hashable conformance
Only provide Hashable conformance on non-Darwin platforms with Swift < 6.2. - On Darwin: CoreGraphics provides Hashable conformance - On Linux/Windows with Swift >= 6.2: swift-corelibs-foundation provides it - On Linux/Windows with Swift < 6.2: We provide it as a workaround This ensures no conflicts once Swift 6.2 includes the fix from swiftlang/swift-corelibs-foundation#5275
1 parent 706d964 commit 5a96a88

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/OpenCoreGraphics/CGGeometry+Hashable.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
// CGGeometry+Hashable.swift
33
// OpenCoreGraphics
44

5-
#if !canImport(Darwin)
6-
// Foundation does not provide Hashable conformance for CG types yet.
5+
// Only provide Hashable conformance on non-Darwin platforms with Swift < 6.2
6+
// - On Darwin: CoreGraphics provides Hashable conformance
7+
// - On Linux/Windows with Swift >= 6.2: swift-corelibs-foundation provides Hashable conformance
8+
// - On Linux/Windows with Swift < 6.2: We provide Hashable conformance as a workaround
9+
//
710
// See https://github.com/swiftlang/swift-corelibs-foundation/issues/5275
11+
#if !canImport(Darwin) && compiler(<6.2)
812
public import Foundation
913

1014
extension CGPoint: Swift.Hashable {

0 commit comments

Comments
 (0)