Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 5 #91

Open
wants to merge 1 commit into
base: swift/4.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "duemunk/Async" "2.0.0"
github "duemunk/Async" "2.0.5"
github "mrackwitz/xcconfigs" "3.0"
21 changes: 13 additions & 8 deletions SwiftTask.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,16 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Yasuhiro Inami";
TargetAttributes = {
1F46DED3199EDF1000F97868 = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
};
1F46DEDE199EDF1000F97868 = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
};
4822F0CF19D00ABF00F5F572 = {
CreatedOnToolsVersion = 6.0.1;
Expand All @@ -321,7 +321,7 @@
};
buildConfigurationList = 1F46DECE199EDF1000F97868 /* Build configuration list for PBXProject "SwiftTask" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -437,12 +437,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -490,12 +492,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand All @@ -517,6 +521,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MTL_ENABLE_DEBUG_INFO = NO;
SWIFT_COMPILATION_MODE = wholemodule;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -538,7 +543,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(PROJECT_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -558,7 +563,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(PROJECT_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -576,7 +581,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -590,7 +595,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
9 changes: 8 additions & 1 deletion SwiftTask/_RecursiveLock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ internal final class _RecursiveLock
{
pthread_mutexattr_destroy(self.attribute)
pthread_mutex_destroy(self.mutex)

#if swift(>=4.1)
self.attribute.deallocate()
#else
self.attribute.deallocate(capacity: 1)
#endif
#if swift(>=4.1)
self.mutex.deallocate()
#else
self.mutex.deallocate(capacity: 1)
#endif
}

internal func lock()
Expand Down
4 changes: 2 additions & 2 deletions SwiftTaskTests/BasicTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BasicTests: _TestCase

}.then { value, errorInfo -> Task in // `task.then {...}` = JavaScript's `promise.then(onFulfilled, onRejected)`

print("value = \(value)") // either "Now OK" or "Now RECOVERED"
print("value = \(value ?? "")") // either "Now OK" or "Now RECOVERED"

XCTAssertTrue(value!.hasPrefix("Now"))
XCTAssertTrue(errorInfo == nil)
Expand All @@ -61,7 +61,7 @@ class BasicTests: _TestCase

}.then { value, errorInfo -> Void in

print("errorInfo = \(errorInfo)")
print("errorInfo = \(errorInfo ?? "")")

XCTAssertTrue(value == nil)
XCTAssertEqual(errorInfo!.error!, "ABORT")
Expand Down
4 changes: 2 additions & 2 deletions SwiftTaskTests/RemoveHandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class RemoveHandlerTests: _TestCase

}.then { value, errorInfo -> Void in

print("value = \(value)")
print("errorInfo = \(errorInfo)")
print("value = \(value ?? "")")
print("errorInfo = \(errorInfo ?? "")")

XCTAssertTrue(value == nil)
XCTAssertTrue(errorInfo != nil)
Expand Down
2 changes: 1 addition & 1 deletion SwiftTaskTests/_TestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class _TestCase: XCTestCase
func wait(_ timeout: TimeInterval = 3)
{
self.waitForExpectations(timeout: timeout) { error in
print("wait error = \(error)")
print("wait error = \(error ?? "")")
}
}

Expand Down