Skip to content

Commit 0e94c01

Browse files
committed
Merge branch 'develop'
2 parents cdf9a88 + 846b55a commit 0e94c01

File tree

8 files changed

+60
-38
lines changed

8 files changed

+60
-38
lines changed

.travis.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,16 @@ matrix:
77
include:
88
- os: Linux
99
dist: trusty
10-
env: SWIFT_SNAPSHOT_NAME="https://swift.org/builds/swift-4.0.3-release/ubuntu1404/swift-4.0.3-RELEASE/swift-4.0.3-RELEASE-ubuntu14.04.tar.gz"
10+
env: SWIFT_SNAPSHOT_NAME="https://swift.org/builds/swift-4.2.3-release/ubuntu1404/swift-4.2.3-RELEASE/swift-4.2.3-RELEASE-ubuntu14.04.tar.gz"
1111
sudo: required
1212
- os: Linux
1313
dist: trusty
14-
env: SWIFT_SNAPSHOT_NAME="https://swift.org/builds/swift-4.1.1-release/ubuntu1404/swift-4.1.1-RELEASE/swift-4.1.1-RELEASE-ubuntu14.04.tar.gz"
14+
env: SWIFT_SNAPSHOT_NAME="https://swift.org/builds/swift-5.0-release/ubuntu1404/swift-5.0-RELEASE/swift-5.0-RELEASE-ubuntu14.04.tar.gz"
1515
sudo: required
16-
- os: Linux
17-
dist: trusty
18-
env: SWIFT_SNAPSHOT_NAME="https://swift.org/builds/swift-4.2.1-release/ubuntu1404/swift-4.2.1-RELEASE/swift-4.2.1-RELEASE-ubuntu14.04.tar.gz"
19-
sudo: required
20-
- os: osx
21-
osx_image: xcode9
22-
- os: osx
23-
osx_image: xcode9.3
24-
- os: osx
25-
osx_image: xcode9.4
26-
- os: osx
27-
osx_image: xcode10
2816
- os: osx
2917
osx_image: xcode10.1
18+
- os: osx
19+
osx_image: xcode10.2
3020

3121

3222
before_install:

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.0
1+
// swift-tools-version:4.2
22

33
import PackageDescription
44

@@ -9,7 +9,7 @@ let package = Package(
99
],
1010
dependencies: [
1111
.package(url: "https://github.com/apple/swift-nio.git",
12-
from: "1.9.2")
12+
from: "1.13.2")
1313
],
1414
targets: [
1515
.target(name: "NIOIRC", dependencies: [ "NIO" ])

Sources/NIOIRC/IRCCommandParser.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public extension IRCCommand {
2121
* The parser validates the argument counts etc and throws exceptions on
2222
* unexpected input.
2323
*/
24-
public init(_ command: String, arguments: [ String ]) throws {
24+
init(_ command: String, arguments: [ String ]) throws {
2525
typealias Error = IRCParserError
2626

2727
func expect(argc: Int) throws {
@@ -255,7 +255,7 @@ public extension IRCCommand {
255255
* The parser validates the argument counts etc and throws exceptions on
256256
* unexpected input.
257257
*/
258-
public init(_ v: Int, arguments: [ String ]) throws {
258+
init(_ v: Int, arguments: [ String ]) throws {
259259
if let code = IRCCommandCode(rawValue: v) {
260260
self = .numeric(code, arguments)
261261
}
@@ -271,7 +271,7 @@ public extension IRCCommand {
271271
* The parser validates the argument counts etc and throws exceptions on
272272
* unexpected input.
273273
*/
274-
public init(_ s: String, _ arguments: String...) throws {
274+
init(_ s: String, _ arguments: String...) throws {
275275
try self.init(s, arguments: arguments)
276276
}
277277

@@ -282,7 +282,7 @@ public extension IRCCommand {
282282
* The parser validates the argument counts etc and throws exceptions on
283283
* unexpected input.
284284
*/
285-
public init(_ v: Int, _ arguments: String...) throws {
285+
init(_ v: Int, _ arguments: String...) throws {
286286
try self.init(v, arguments: arguments)
287287
}
288288
}

Sources/NIOIRC/Model/IRCChannelName.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ public struct IRCChannelName : Hashable, CustomStringConvertible {
4242
return storage
4343
}
4444

45-
public var hashValue: Int {
46-
return normalized.hashValue
47-
}
45+
#if compiler(>=5)
46+
public func hash(into hasher: inout Hasher) {
47+
normalized.hash(into: &hasher)
48+
}
49+
#else
50+
public var hashValue: Int {
51+
return normalized.hashValue
52+
}
53+
#endif
4854

4955
public static func ==(lhs: IRCChannelName, rhs: IRCChannelName) -> Bool {
5056
return lhs.normalized == rhs.normalized

Sources/NIOIRC/Model/IRCMessageRecipient.swift

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,23 @@ public enum IRCMessageRecipient : Hashable {
2222
// or: user, or user%host, @server, etc
2323
// or: nickname!user@host
2424

25-
public var hashValue: Int {
26-
switch self {
27-
case .channel (let name): return name.hashValue
28-
case .nickname(let name): return name.hashValue
29-
case .everything: return 42
25+
#if compiler(>=5)
26+
public func hash(into hasher: inout Hasher) {
27+
switch self {
28+
case .channel (let name): return name.hash(into: &hasher)
29+
case .nickname(let name): return name.hash(into: &hasher)
30+
case .everything: return 42.hash(into: &hasher) // TBD?
31+
}
3032
}
31-
}
33+
#else
34+
public var hashValue: Int {
35+
switch self {
36+
case .channel (let name): return name.hashValue
37+
case .nickname(let name): return name.hashValue
38+
case .everything: return 42
39+
}
40+
}
41+
#endif
3242

3343
public static func ==(lhs: IRCMessageRecipient, rhs: IRCMessageRecipient)
3444
-> Bool
@@ -44,7 +54,7 @@ public enum IRCMessageRecipient : Hashable {
4454

4555
public extension IRCMessageRecipient {
4656

47-
public init?(_ s: String) {
57+
init?(_ s: String) {
4858
if s == "*" {
4959
self = .everything
5060
}
@@ -59,7 +69,7 @@ public extension IRCMessageRecipient {
5969
}
6070
}
6171

62-
public var stringValue : String {
72+
var stringValue : String {
6373
switch self {
6474
case .channel (let name): return name.stringValue
6575
case .nickname(let name): return name.stringValue

Sources/NIOIRC/Model/IRCNickName.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ public struct IRCNickName : Hashable, CustomStringConvertible {
3737
return storage
3838
}
3939

40-
public var hashValue: Int {
41-
return normalized.hashValue
42-
}
40+
#if compiler(>=5)
41+
public func hash(into hasher: inout Hasher) {
42+
normalized.hash(into: &hasher)
43+
}
44+
#else
45+
public var hashValue: Int {
46+
return normalized.hashValue
47+
}
48+
#endif
4349

4450
public static func ==(lhs: IRCNickName, rhs: IRCNickName) -> Bool {
4551
return lhs.normalized == rhs.normalized

Sources/NIOIRC/Model/IRCServerName.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ public struct IRCServerName : Hashable {
3434
return storage
3535
}
3636

37-
public var hashValue: Int {
38-
return normalized.hashValue
39-
}
37+
#if compiler(>=5)
38+
public func hash(into hasher: inout Hasher) {
39+
normalized.hash(into: &hasher)
40+
}
41+
#else
42+
public var hashValue: Int {
43+
return normalized.hashValue
44+
}
45+
#endif
4046

4147
public static func ==(lhs: IRCServerName, rhs: IRCServerName) -> Bool {
4248
return lhs.normalized == rhs.normalized

Sources/NIOIRC/Model/IRCUserID.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ public struct IRCUserID : Hashable, CustomStringConvertible {
5252
}
5353
}
5454

55-
public var hashValue: Int { return nick.hashValue }
55+
#if compiler(>=5)
56+
public func hash(into hasher: inout Hasher) { nick.hash(into: &hasher) }
57+
#else
58+
public var hashValue: Int { return nick.hashValue }
59+
#endif
5660

5761
public static func ==(lhs: IRCUserID, rhs: IRCUserID) -> Bool {
5862
return lhs.nick == rhs.nick && lhs.user == rhs.user && lhs.host == rhs.host

0 commit comments

Comments
 (0)