From 162a47fa43496a348d38f3b2b5a34a98f3bf5043 Mon Sep 17 00:00:00 2001 From: James Bean Date: Wed, 12 Jun 2019 12:31:41 -0400 Subject: [PATCH] Update to Swift 5 (#121) * Fix some errors * Update Travis * Update Structure and Math versions --- .travis.yml | 4 ++-- Package.resolved | 12 ++++++------ Package.swift | 4 ++-- Sources/Duration/Rhythm/ProportionTree.swift | 3 +-- Sources/Duration/Tempo/Tempo.swift | 2 +- .../Data Structures/IntervalSearchTree.swift | 2 +- Sources/Pitch/NoteNumberRepresentable.swift | 4 ++-- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index d312762..bd0b6c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,11 @@ os: language: generic sudo: required dist: trusty -osx_image: xcode10 +osx_image: xcode10.2 install: - eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" env: - - SWIFT_VERSION=4.2 + - SWIFT_VERSION=5.0 script: - swift package update - swift test diff --git a/Package.resolved b/Package.resolved index 19c8740..616bfbf 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,9 +5,9 @@ "package": "Math", "repositoryURL": "https://github.com/dn-m/Math", "state": { - "branch": null, - "revision": "075ebb5a934251ed7acbe4feace925ed7e322d0f", - "version": "0.6.0" + "branch": "swift-5", + "revision": "51f8032aa2aea3e8a88b44dcc858c4551b855478", + "version": null } }, { @@ -23,9 +23,9 @@ "package": "Structure", "repositoryURL": "https://github.com/dn-m/Structure", "state": { - "branch": null, - "revision": "11e920b1b883fe169c5ebb58e6489c0f28e9ad90", - "version": "0.20.0" + "branch": "swift-5", + "revision": "8f67514cba950f60ee992a8d0996d4f11d9654b0", + "version": null } } ] diff --git a/Package.swift b/Package.swift index e823da3..da6ea5e 100644 --- a/Package.swift +++ b/Package.swift @@ -13,8 +13,8 @@ let package = Package( .library(name: "MusicModel", targets: ["MusicModel"]) ], dependencies: [ - .package(url: "https://github.com/dn-m/Structure", from: "0.19.0"), - .package(url: "https://github.com/dn-m/Math", from: "0.6.0") + .package(url: "https://github.com/dn-m/Structure", from: "0.23.0"), + .package(url: "https://github.com/dn-m/Math", from: "0.7.0") ], targets: [ diff --git a/Sources/Duration/Rhythm/ProportionTree.swift b/Sources/Duration/Rhythm/ProportionTree.swift index aec5c61..8687295 100644 --- a/Sources/Duration/Rhythm/ProportionTree.swift +++ b/Sources/Duration/Rhythm/ProportionTree.swift @@ -137,7 +137,7 @@ public func * (duration: Int, durations: [Int]) -> ProportionTree { /// Tree recording the change (in degree of power-of-two) needed to normalize a /// `ProprtionTree`. -typealias DistanceTree = Tree +public typealias DistanceTree = Tree extension Tree where Branch == Int, Leaf == Int { @@ -178,7 +178,6 @@ extension Tree where Branch == Int, Leaf == Int { default: fatalError("Incompatible trees") } - return propagatedUp } return propagatedDown(self, propagatedUp(self), inherited: nil) diff --git a/Sources/Duration/Tempo/Tempo.swift b/Sources/Duration/Tempo/Tempo.swift index 9966851..6dbecc8 100644 --- a/Sources/Duration/Tempo/Tempo.swift +++ b/Sources/Duration/Tempo/Tempo.swift @@ -464,7 +464,7 @@ public extension Tempo.Interpolation { /// An ordered, contiguous collection of `Tempo.Interpolation.Fragments` indexed by their /// fractional offset. - public typealias Collection = ContiguousSegmentCollection + typealias Collection = ContiguousSegmentCollection } /// A class which encapsulates the stateful incremental building process of diff --git a/Sources/MusicModel/Data Structures/IntervalSearchTree.swift b/Sources/MusicModel/Data Structures/IntervalSearchTree.swift index fb026a9..f50f1ed 100644 --- a/Sources/MusicModel/Data Structures/IntervalSearchTree.swift +++ b/Sources/MusicModel/Data Structures/IntervalSearchTree.swift @@ -17,7 +17,7 @@ import Math public struct IntervalSearchTree { /// Underlying `AVLTree` augmented for interval searching purposes. - typealias Base = AVLTree + public typealias Base = AVLTree public struct Node { diff --git a/Sources/Pitch/NoteNumberRepresentable.swift b/Sources/Pitch/NoteNumberRepresentable.swift index f72f2e9..5866b1b 100644 --- a/Sources/Pitch/NoteNumberRepresentable.swift +++ b/Sources/Pitch/NoteNumberRepresentable.swift @@ -54,8 +54,8 @@ extension NoteNumberRepresentable { // MARK: - Hashable /// - Returns: The hash value of a `NoteNumberRepresentable` type. - public var hashValue: Int { - return value.hashValue + public func hash(into hasher: inout Hasher) { + hasher.combine(value) } }