Permalink
Browse files

Warnings fixes for Swift 5

  • Loading branch information...
mxcl committed Dec 23, 2018
1 parent 485131b commit 8054c287cf440731184f0cf8f389e2a1b8977550
Showing with 8 additions and 8 deletions.
  1. +2 −2 Sources/Deprecations.swift
  2. +2 −2 Sources/Guarantee.swift
  3. +4 −4 Sources/Resolver.swift
@@ -37,15 +37,15 @@ public func wrap<T>(_ body: (@escaping (T) -> Void) throws -> Void) -> Promise<T

public extension Promise {
@available(*, deprecated, message: "See `ensure`")
public func always(on q: DispatchQueue = .main, execute body: @escaping () -> Void) -> Promise {
func always(on q: DispatchQueue = .main, execute body: @escaping () -> Void) -> Promise {
return ensure(on: q, body)
}
}

public extension Thenable {
#if PMKFullDeprecations
/// disabled due to ambiguity with the other `.flatMap`
@available(*, deprecated: 6.1, message: "See: `compactMap`")
@available(*, deprecated, message: "See: `compactMap`")
func flatMap<U>(on: DispatchQueue? = conf.Q.map, _ transform: @escaping(T) throws -> U?) -> Promise<U> {
return compactMap(on: on, transform)
}
@@ -105,15 +105,15 @@ public extension Guarantee {
return rg
}

public func asVoid() -> Guarantee<Void> {
func asVoid() -> Guarantee<Void> {
return map(on: nil) { _ in }
}

/**
Blocks this thread, so you know, don’t call this on a serial thread that
any part of your chain may use. Like the main thread for example.
*/
public func wait() -> T {
func wait() -> T {

if Thread.isMainThread {
conf.logHandler(.waitOnMainThread)
@@ -25,12 +25,12 @@ public extension Resolver {
}

/// Resolves the promise with the provided result
public func resolve(_ result: Result<T>) {
func resolve(_ result: Result<T>) {
box.seal(result)
}

/// Resolves the promise with the provided value or error
public func resolve(_ obj: T?, _ error: Error?) {
func resolve(_ obj: T?, _ error: Error?) {
if let error = error {
reject(error)
} else if let obj = obj {
@@ -41,7 +41,7 @@ public extension Resolver {
}

/// Fulfills the promise with the provided value unless the provided error is non-nil
public func resolve(_ obj: T, _ error: Error?) {
func resolve(_ obj: T, _ error: Error?) {
if let error = error {
reject(error)
} else {
@@ -50,7 +50,7 @@ public extension Resolver {
}

/// Resolves the promise, provided for non-conventional value-error ordered completion handlers.
public func resolve(_ error: Error?, _ obj: T?) {
func resolve(_ error: Error?, _ obj: T?) {
resolve(obj, error)
}
}

0 comments on commit 8054c28

Please sign in to comment.