feat: Resolving concurrency warnings

This commit is contained in:
2024-06-11 10:34:19 -04:00
parent e07df0e426
commit bf2e65fb8f
15 changed files with 156 additions and 130 deletions

View File

@@ -19,7 +19,7 @@ public struct Flagged: Equatable, Sendable {
public init(
wrappedValue: Double,
_ checkValue: @escaping (Double) -> CheckResult
_ checkValue: @escaping @Sendable (Double) -> CheckResult
) {
self.checkValue = .init(checkValue)
self.wrappedValue = wrappedValue
@@ -35,10 +35,10 @@ public struct Flagged: Equatable, Sendable {
checkValue(wrappedValue)
}
public struct GoodMessageHandler {
let message: (Double) -> String?
public init(message: @escaping (Double) -> String?) {
public struct GoodMessageHandler: Sendable {
let message: @Sendable (Double) -> String?
public init(message: @escaping @Sendable (Double) -> String?) {
self.message = message
}

View File

@@ -1,6 +1,6 @@
import Foundation
extension Optional: ExpressibleByIntegerLiteral where Wrapped: ExpressibleByIntegerLiteral {
extension Optional: @retroactive ExpressibleByIntegerLiteral where Wrapped: ExpressibleByIntegerLiteral {
public typealias IntegerLiteralType = Wrapped.IntegerLiteralType
@@ -9,7 +9,7 @@ extension Optional: ExpressibleByIntegerLiteral where Wrapped: ExpressibleByInte
}
}
extension Optional: ExpressibleByFloatLiteral where Wrapped: ExpressibleByFloatLiteral {
extension Optional: @retroactive ExpressibleByFloatLiteral where Wrapped: ExpressibleByFloatLiteral {
public typealias FloatLiteralType = Wrapped.FloatLiteralType
public init(floatLiteral value: Wrapped.FloatLiteralType) {
@@ -17,7 +17,7 @@ extension Optional: ExpressibleByFloatLiteral where Wrapped: ExpressibleByFloatL
}
}
extension Optional: AdditiveArithmetic where Wrapped: AdditiveArithmetic {
extension Optional: @retroactive AdditiveArithmetic where Wrapped: AdditiveArithmetic {
public static func - (lhs: Optional<Wrapped>, rhs: Optional<Wrapped>) -> Optional<Wrapped> {
switch (lhs, rhs) {
@@ -58,7 +58,7 @@ extension Optional: AdditiveArithmetic where Wrapped: AdditiveArithmetic {
}
extension Optional: Numeric where Wrapped: Numeric {
extension Optional: @retroactive Numeric where Wrapped: Numeric {
public static func *= (lhs: inout Optional<Wrapped>, rhs: Optional<Wrapped>) {
switch (lhs, rhs) {
@@ -107,7 +107,7 @@ extension Optional: Numeric where Wrapped: Numeric {
public typealias Magnitude = Wrapped.Magnitude
}
extension Optional: Comparable where Wrapped: Comparable {
extension Optional: @retroactive Comparable where Wrapped: Comparable {
public static func < (lhs: Optional<Wrapped>, rhs: Optional<Wrapped>) -> Bool {
switch (lhs, rhs) {
case let (.some(lhs), .some(rhs)):

View File

@@ -72,7 +72,7 @@ extension Percentage: Comparable {
extension Percentage: CustomStringConvertible {
static var formatter: NumberFormatter = {
static let formatter: NumberFormatter = {
let formatter = NumberFormatter()
formatter.numberStyle = .percent
return formatter