Skip to content

Commit

Permalink
Fix Xcode 16 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkenso committed Sep 17, 2024
1 parent 592d2ba commit 83c0393
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,9 @@ public enum DictionaryCodingKey {
case index(Int)
}

extension DictionaryCodingKey: CodingKey {
public init(stringValue: String) {
self = .key(stringValue)
}

public var stringValue: String {
switch self {
case .key(let key):
return "\(key)"
case .index(let index):
return "\(index)"
}
}

public init(intValue: Int) {
self = .index(intValue)
}

public var intValue: Int? {
if case .index(let index) = self {
return index
} else {
return nil
}
}
}

extension DictionaryCodingKey: ExpressibleByStringLiteral {
public init(stringLiteral value: StringLiteralType) {
self.init(stringValue: value)
self = .key(String(value))
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/SpellbookFoundation/Low Level/AuditToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extension audit_token_t {
public var pidversion: Int32 { audit_token_to_pidversion(self) }
}

extension audit_token_t: SafePOD, UnsafePOD {}
extension audit_token_t: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {}

extension NSXPCConnection {
public var auditToken: audit_token_t {
Expand Down
24 changes: 12 additions & 12 deletions Sources/SpellbookFoundation/Low Level/POD+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ public protocol UnsafePOD: PODUnsafeHashable {}

// MARK: - Oftenly used POD types

extension timespec: SafePOD, UnsafePOD {}
extension fsid_t: SafePOD, UnsafePOD {}
extension attrlist: SafePOD, UnsafePOD {}
extension attribute_set: SafePOD, UnsafePOD {}
extension attrreference: SafePOD, UnsafePOD {}
extension diskextent: SafePOD, UnsafePOD {}
extension timespec: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {}
extension fsid_t: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {}
extension attrlist: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {}
extension attribute_set: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {}
extension attrreference: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {}
extension diskextent: SpellbookFoundation.SafePOD, SpellbookFoundation.UnsafePOD {}

extension stat: SafePOD {}
extension statfs: SafePOD {}
extension stat: SpellbookFoundation.SafePOD {}
extension statfs: SpellbookFoundation.SafePOD {}

extension timeval: SafePOD {}
extension timeval: SpellbookFoundation.SafePOD {}

extension stat: Hashable {
extension stat: @retroactive Hashable {
public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.st_dev == rhs.st_dev &&
lhs.st_mode == rhs.st_mode &&
Expand Down Expand Up @@ -135,7 +135,7 @@ extension stat: Hashable {
}
}

extension statfs: Hashable {
extension statfs: @retroactive Hashable {
public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.f_bsize == rhs.f_bsize &&
lhs.f_iosize == rhs.f_iosize &&
Expand Down Expand Up @@ -175,7 +175,7 @@ extension statfs: Hashable {
}
}

extension timeval: Hashable {
extension timeval: @retroactive Hashable {
public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.tv_sec == rhs.tv_sec &&
lhs.tv_usec == rhs.tv_usec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import Foundation

public final class ConcurrentBlockOperation: Operation {
public final class ConcurrentBlockOperation: Operation, @unchecked Sendable {
@Atomic private var state: Bool?
private let block: (ValueView<Bool>, @escaping () -> Void) -> Void

Expand Down
4 changes: 2 additions & 2 deletions Sources/SpellbookFoundation/ValueObserving/EventAsk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public class EventAskEx<Input, Transformed, Output> {
}

public func ask(_ value: Input, timeout: Timeout? = nil) async -> Output {
await withCheckedContinuation {
askAsync(value, timeout: timeout, completion: $0.resume(returning:))
await withCheckedContinuation { continuation in
askAsync(value, timeout: timeout) { continuation.resume(returning: $0) }
}
}

Expand Down
26 changes: 0 additions & 26 deletions Tests/SpellbookTests/Threading & Concurrency/PosixLocksTests.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private struct Dummy<T> {
extension Dummy {
func asyncValue() async -> T {
await withCheckedContinuation { continuation in
value(reply: continuation.resume(returning:))
value { continuation.resume(returning: $0) }
}
}

Expand Down

0 comments on commit 83c0393

Please sign in to comment.