Merge pull request #17 from lorentey/support-5.2

Work around some compiler issues in Swift 5.2
This commit is contained in:
Karoy Lorentey authored and GitHub committed 2020-11-13 18:32:42 -08:00
commit 6535403113
2 files changed
+5 -2

No files matched your search

+2 -1
View File
@@ -51,7 +51,8 @@ extension Unmanaged {
extension Unmanaged {
fileprivate static func passRetained(_ instance: __owned Instance?) -> Self? {
guard let instance = instance else { return nil }
return .passRetained(instance)
// Note: Swift 5.2 doesn't like this optional promotion without the explicit cast
return .passRetained(instance) as Self
}
}
@@ -167,9 +167,11 @@ extension List {
withExtendedLifetime(node) {}
return result
}
}
extension List where Value: Hashable {
@inline(never)
func readUnique(expectedCount: Int = 0) -> Set<Value> where Value: Hashable {
func readUnique(expectedCount: Int = 0) -> Set<Value> {
var result: Set<Value> = []
result.reserveCapacity(expectedCount)
var node = head