Skip to content

Commit

Permalink
apply workaround for 61708 only when swift<5.8 (#120)
Browse files Browse the repository at this point in the history
issues/61708 was fixed in swift 5.8
swiftlang/swift#61966
https://github.com/apple/swift/commits/swift-5.8-RELEASE?after=f9611bc8e745b1b9a98d494236adb6d6c739fe97+1364&branch=swift-5.8-RELEASE&qualified_name=refs%2Ftags%2Fswift-5.8-RELEASE

Co-authored-by: 강성규/연구/인포테인먼트소프트웨어개발팀 <[email protected]>
  • Loading branch information
kodok1988 and seongkue authored Nov 3, 2023
1 parent 023201c commit 96f3479
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/CasePaths/EnumReflection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,11 @@ private struct MetadataKind: Equatable {
}

@_spi(Reflection) public func tag<Enum>(of value: Enum) -> UInt32 {
#if swift(<5.8)
// NB: Workaround for https://github.com/apple/swift/issues/61708
guard self.typeDescriptor.emptyCaseCount + self.typeDescriptor.payloadCaseCount > 1
else { return 0 }
#endif
return withUnsafePointer(to: value) {
self.valueWitnessTable.getEnumTag($0, self.ptr)
}
Expand Down

0 comments on commit 96f3479

Please sign in to comment.