Skip to content

Commit 6095c2c

Browse files
authored
Merge pull request #55 from CodaFi/touch-up
Update to Swift 5
2 parents c8639a0 + 4b265e0 commit 6095c2c

File tree

13 files changed

+102
-90
lines changed

13 files changed

+102
-90
lines changed

.travis.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ matrix:
55
include:
66
- os: osx
77
language: objective-c
8-
osx_image: xcode9.3
8+
osx_image: xcode10.2
99
before_install:
1010
- git submodule update --init --recursive
1111
script:
12-
# Restore pod build before shipping for 3.0
13-
# - pod lib lint
1412
- carthage build --no-skip-current
1513
- os: osx
1614
language: objective-c
17-
osx_image: xcode9.3
15+
osx_image: xcode10.2
1816
before_install:
1917
- git submodule update --init --recursive
2018
script:
@@ -31,9 +29,9 @@ matrix:
3129
before_install:
3230
- git submodule update --init --recursive
3331
- wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
34-
- wget https://swift.org/builds/swift-4.1-release/ubuntu1404/swift-4.1-RELEASE/swift-4.1-RELEASE-ubuntu14.04.tar.gz
35-
- tar xzf swift-4.1-RELEASE-ubuntu14.04.tar.gz
36-
- export PATH=${PWD}/swift-4.1-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
32+
- wget https://swift.org/builds/swift-5.0-release/ubuntu1404/swift-5.0-RELEASE/swift-5.0-RELEASE-ubuntu14.04.tar.gz
33+
- tar xzf swift-5.0-RELEASE-ubuntu14.04.tar.gz
34+
- export PATH=${PWD}/swift-5.0-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
3735
script:
3836
- swift test
3937
notifications:

Cartfile.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "typelift/SwiftCheck" "0.10.0"
1+
github "typelift/SwiftCheck" "0.12.0"

Concurrent.xcodeproj/project.pbxproj

+67-66
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

Concurrent.xcodeproj/xcshareddata/xcschemes/Concurrent-iOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0930"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Concurrent.xcodeproj/xcshareddata/xcschemes/Concurrent-tvOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0930"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Concurrent.xcodeproj/xcshareddata/xcschemes/Concurrent-watchOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0930"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Concurrent.xcodeproj/xcshareddata/xcschemes/Concurrent.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0930"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.0
1+
// swift-tools-version:5.0
22

33
import PackageDescription
44

Sources/Concurrent/IChan.swift

+9-6
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@ public struct IChan<A> {
2828
self.init(v)
2929
}
3030

31-
/// Reads all the values from a channel into a list.
31+
/// Reads all the values from a channel into a lazy sequence.
3232
///
33-
/// This computation may block on empty IVars.
34-
public func read() -> [A] {
35-
let (a, ic) = self.ivar.read()
36-
return [a] + ic.read()
33+
/// Though the returned sequence is lazy, this computation may block
34+
/// on reads of empty IVars.
35+
public func read() -> LazySequence<UnfoldSequence<A, IChan<A>>> {
36+
return sequence(state: self, next: { (ichan) -> A in
37+
let (a, ic) = ichan.ivar.read()
38+
defer { ichan = ic }
39+
return a
40+
}).lazy
3741
}
3842

39-
4043
/// Writes a single value to the head of the channel and returns a new write
4144
/// head.
4245
///

Sources/Concurrent/IVar.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public struct IVar<A> {
2929
/// Creates a new `IVar` containing the supplied value.
3030
public init(initial : @autoclosure @escaping () -> A) {
3131
let lock = MVar<()>()
32-
self.init(lock, MVar(initial: initial()), initial)
32+
self.init(lock, MVar(initial: initial()), initial())
3333
}
3434

3535
/// Returns the contents of the `IVar`.

Sources/Concurrent/TVar.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public final class TVar<T> : Comparable, Hashable {
3232
}
3333

3434
/// The hash value uniquely identifying this `TVar`.
35-
public var hashValue : Int {
36-
return _id
35+
public func hash(into hasher: inout Hasher) {
36+
self._id.hash(into: &hasher)
3737
}
3838

3939
internal var value : TVarType<T>
@@ -86,7 +86,9 @@ internal final class TVarType<T> : Hashable {
8686
var _fingerprint : Int
8787
var _val : Any
8888

89-
var hashValue : Int { return _fingerprint }
89+
func hash(into hasher: inout Hasher) {
90+
self._fingerprint.hash(into: &hasher)
91+
}
9092

9193
init(_ v : T, _ fingerprint : Int) {
9294
self._fingerprint = fingerprint

0 commit comments

Comments
 (0)