Skip to content

Commit 077c096

Browse files
authored
Merge pull request #286 from rabbitinspace/master
Fix building with Xcode 10.2 and migrate to Swift 5
2 parents 8c6fc15 + e6983b1 commit 077c096

14 files changed

+28
-47
lines changed

.swift-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.2
1+
5.0

.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ matrix:
55
include:
66
- os: osx
77
language: objective-c
8-
osx_image: xcode10
8+
osx_image: xcode10.2
99
before_install:
1010
- git submodule update --init --recursive
1111
- pushd Utilities
@@ -17,7 +17,7 @@ matrix:
1717
- carthage build --no-skip-current
1818
- os: osx
1919
language: objective-c
20-
osx_image: xcode10
20+
osx_image: xcode10.2
2121
before_install:
2222
- git submodule update --init --recursive
2323
- pushd Utilities
@@ -37,9 +37,9 @@ matrix:
3737
before_install:
3838
- git submodule update --init --recursive
3939
- wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
40-
- wget https://swift.org/builds/swift-4.2-release/ubuntu1404/swift-4.2-RELEASE/swift-4.2-RELEASE-ubuntu14.04.tar.gz
41-
- tar xzf swift-4.2-RELEASE-ubuntu14.04.tar.gz
42-
- export PATH=${PWD}/swift-4.2-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
40+
- wget https://swift.org/builds/swift-5.0-release/ubuntu1404/swift-5.0-RELEASE/swift-5.0-RELEASE-ubuntu14.04.tar.gz
41+
- tar xzf swift-5.0-RELEASE-ubuntu14.04.tar.gz
42+
- export PATH=${PWD}/swift-5.0-RELEASE-ubuntu14.04/usr/bin:"${PATH}"
4343
- pushd Utilities
4444
- ./compile.sh
4545
- popd

Cartfile.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "trill-lang/FileCheck" "0.0.8"
1+
github "trill-lang/FileCheck" "0.1.0"

Carthage/Checkouts/FileCheck

Package.swift

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

33
import PackageDescription
44

@@ -10,7 +10,7 @@ let package = Package(
1010
targets: ["SwiftCheck"]),
1111
],
1212
dependencies: [
13-
.package(url: "https://github.com/llvm-swift/FileCheck.git", from: "0.0.3")
13+
.package(url: "https://github.com/llvm-swift/FileCheck.git", from: "0.1.0")
1414
],
1515
targets: [
1616
.target(

Sources/SwiftCheck/Modifiers.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ fileprivate final class IsoOfImpl<T : Hashable & CoArbitrary & Arbitrary, U : Eq
462462
static func shrink(_ f : IsoOfImpl<T, U>) -> [IsoOfImpl<T, U>] {
463463
return f.table.flatMap { (t) -> [IsoOfImpl<T, U>] in
464464
let (x, y) = t
465-
return Zip2Sequence(_sequence1: T.shrink(x), _sequence2: U.shrink(y)).map({ t in
465+
return zip(T.shrink(x), U.shrink(y)).map({ t in
466466
let (y1 , y2) = t
467467
return IsoOfImpl<T, U>(
468468
{ (z : T) -> U in

Sources/SwiftCheck/Test.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ private func printDistributionGraph(_ st : CheckerState) {
10061006
}
10071007

10081008
let gAllLabels : [String] = st.collected.map({ (s : Set<String>) in
1009-
return s.filter({ t in st.labels[t] == .some(0) }).reduce("", { (l : String, r : String) in l + ", " + r })
1009+
return s.filter({ t in st.labels[t] == .some(0) }).sorted().reduce("", { (l : String, r : String) in l + ", " + r })
10101010
})
10111011
let gAll : [[String]] = gAllLabels.filter({ !$0.isEmpty }).sorted().groupBy(==)
10121012
let gPrint : [String] = gAll.map({ ss in showP((ss.count * 100) / st.successfulTestCount) + ss.first! })

Sources/SwiftCheck/WitnessedArbitrary.swift

-7
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,6 @@ extension Range : Arbitrary where Bound : Arbitrary {
135135
}
136136
}
137137

138-
extension LazyCollection : Arbitrary where Base : Arbitrary {
139-
/// Returns a generator of `LazyCollection`s of arbitrary `Base`s.
140-
public static var arbitrary : Gen<LazyCollection<Base>> {
141-
return Base.arbitrary.map({ $0.lazy })
142-
}
143-
}
144-
145138
extension LazySequence : Arbitrary where Base : Arbitrary {
146139
/// Returns a generator of `LazySequence`s of arbitrary `Base`s.
147140
public static var arbitrary : Gen<LazySequence<Base>> {

SwiftCheck.xcodeproj/project.pbxproj

+8-20
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@
532532
isa = PBXProject;
533533
attributes = {
534534
LastSwiftUpdateCheck = 0730;
535-
LastUpgradeCheck = 0930;
535+
LastUpgradeCheck = 1020;
536536
ORGANIZATIONNAME = Typelift;
537537
TargetAttributes = {
538538
8240CCB01C3A123600EF4D29 = {
@@ -554,17 +554,17 @@
554554
};
555555
84DF75F71B0BD54600C912B0 = {
556556
CreatedOnToolsVersion = 6.4;
557-
LastSwiftMigration = 0900;
557+
LastSwiftMigration = 1020;
558558
};
559559
84DF76011B0BD54600C912B0 = {
560560
CreatedOnToolsVersion = 6.4;
561-
LastSwiftMigration = 0900;
561+
LastSwiftMigration = 1020;
562562
};
563563
};
564564
};
565565
buildConfigurationList = 844FCC87198B320500EB242A /* Build configuration list for PBXProject "SwiftCheck" */;
566566
compatibilityVersion = "Xcode 3.2";
567-
developmentRegion = English;
567+
developmentRegion = en;
568568
hasScannedForEncodings = 0;
569569
knownRegions = (
570570
en,
@@ -847,7 +847,6 @@
847847
SWIFT_INSTALL_OBJC_HEADER = NO;
848848
SWIFT_OBJC_INTERFACE_HEADER_NAME = "";
849849
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
850-
SWIFT_VERSION = 4.2;
851850
TARGETED_DEVICE_FAMILY = 3;
852851
TVOS_DEPLOYMENT_TARGET = 9.0;
853852
WATCHOS_DEPLOYMENT_TARGET = 2.0;
@@ -880,7 +879,6 @@
880879
SKIP_INSTALL = YES;
881880
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
882881
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
883-
SWIFT_VERSION = 4.2;
884882
TARGETED_DEVICE_FAMILY = 3;
885883
TVOS_DEPLOYMENT_TARGET = 9.0;
886884
VALIDATE_PRODUCT = YES;
@@ -903,7 +901,6 @@
903901
SDKROOT = appletvos;
904902
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
905903
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
906-
SWIFT_VERSION = 4.2;
907904
TVOS_DEPLOYMENT_TARGET = 9.0;
908905
};
909906
name = Debug;
@@ -923,7 +920,6 @@
923920
SDKROOT = appletvos;
924921
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
925922
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
926-
SWIFT_VERSION = 4.2;
927923
TVOS_DEPLOYMENT_TARGET = 9.0;
928924
VALIDATE_PRODUCT = YES;
929925
};
@@ -933,6 +929,7 @@
933929
isa = XCBuildConfiguration;
934930
buildSettings = {
935931
ALWAYS_SEARCH_USER_PATHS = NO;
932+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
936933
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
937934
CLANG_CXX_LIBRARY = "libc++";
938935
CLANG_ENABLE_MODULES = YES;
@@ -980,6 +977,7 @@
980977
ONLY_ACTIVE_ARCH = YES;
981978
SDKROOT = macosx;
982979
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
980+
SWIFT_VERSION = 5.0;
983981
VERSIONING_SYSTEM = "apple-generic";
984982
VERSION_INFO_PREFIX = "";
985983
};
@@ -989,6 +987,7 @@
989987
isa = XCBuildConfiguration;
990988
buildSettings = {
991989
ALWAYS_SEARCH_USER_PATHS = NO;
990+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
992991
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
993992
CLANG_CXX_LIBRARY = "libc++";
994993
CLANG_ENABLE_MODULES = YES;
@@ -1028,6 +1027,7 @@
10281027
MACOSX_DEPLOYMENT_TARGET = 10.9;
10291028
MTL_ENABLE_DEBUG_INFO = NO;
10301029
SDKROOT = macosx;
1030+
SWIFT_VERSION = 5.0;
10311031
VERSIONING_SYSTEM = "apple-generic";
10321032
VERSION_INFO_PREFIX = "";
10331033
};
@@ -1062,7 +1062,6 @@
10621062
SKIP_INSTALL = YES;
10631063
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
10641064
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
1065-
SWIFT_VERSION = 4.2;
10661065
};
10671066
name = Debug;
10681067
};
@@ -1095,7 +1094,6 @@
10951094
SKIP_INSTALL = YES;
10961095
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
10971096
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
1098-
SWIFT_VERSION = 4.2;
10991097
};
11001098
name = Release;
11011099
};
@@ -1120,7 +1118,6 @@
11201118
PRODUCT_NAME = "$(TARGET_NAME)";
11211119
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
11221120
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
1123-
SWIFT_VERSION = 4.2;
11241121
};
11251122
name = Debug;
11261123
};
@@ -1142,7 +1139,6 @@
11421139
PRODUCT_NAME = "$(TARGET_NAME)";
11431140
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
11441141
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
1145-
SWIFT_VERSION = 4.2;
11461142
};
11471143
name = Release;
11481144
};
@@ -1177,8 +1173,6 @@
11771173
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos";
11781174
SWIFT_INSTALL_OBJC_HEADER = NO;
11791175
SWIFT_OBJC_INTERFACE_HEADER_NAME = "";
1180-
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
1181-
SWIFT_VERSION = 4.2;
11821176
TARGETED_DEVICE_FAMILY = "1,2,3";
11831177
TVOS_DEPLOYMENT_TARGET = 9.0;
11841178
WATCHOS_DEPLOYMENT_TARGET = 2.0;
@@ -1211,8 +1205,6 @@
12111205
SKIP_INSTALL = YES;
12121206
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos";
12131207
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
1214-
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
1215-
SWIFT_VERSION = 4.2;
12161208
TARGETED_DEVICE_FAMILY = "1,2,3";
12171209
TVOS_DEPLOYMENT_TARGET = 9.0;
12181210
VALIDATE_PRODUCT = YES;
@@ -1242,8 +1234,6 @@
12421234
SDKROOT = iphoneos;
12431235
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos";
12441236
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1245-
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
1246-
SWIFT_VERSION = 4.2;
12471237
};
12481238
name = Debug;
12491239
};
@@ -1265,8 +1255,6 @@
12651255
SDKROOT = iphoneos;
12661256
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvsimulator appletvos";
12671257
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
1268-
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
1269-
SWIFT_VERSION = 4.2;
12701258
VALIDATE_PRODUCT = YES;
12711259
};
12721260
name = Release;

SwiftCheck.xcodeproj/xcshareddata/xcschemes/SwiftCheck-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"

SwiftCheck.xcodeproj/xcshareddata/xcschemes/SwiftCheck-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"

SwiftCheck.xcodeproj/xcshareddata/xcschemes/SwiftCheck.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"

Tests/SwiftCheckTests/ComplexSpec.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ class ComplexSpec : XCTestCase {
2929
lower,
3030
numeric,
3131
special,
32-
]).proliferateNonEmpty.suchThat({ $0[($0.endIndex - 1)] != "." }).map(String.init(stringInterpolationSegment:))
32+
]).proliferateNonEmpty.suchThat({ $0[($0.endIndex - 1)] != "." }).map { String($0) }
3333

3434
let hostname = Gen<Character>.one(of: [
3535
lower,
3636
numeric,
3737
Gen.pure("-"),
38-
]).proliferateNonEmpty.map(String.init(stringInterpolationSegment:))
38+
]).proliferateNonEmpty.map { String($0) }
3939

40-
let tld = lower.proliferateNonEmpty.suchThat({ $0.count > 1 }).map(String.init(stringInterpolationSegment:))
40+
let tld = lower.proliferateNonEmpty.suchThat({ $0.count > 1 }).map { String($0) }
4141

4242
let emailGen = glue([localEmail, Gen.pure("@"), hostname, Gen.pure("."), tld])
4343

Tests/SwiftCheckTests/LambdaSpec.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ struct Name : Arbitrary, Equatable, Hashable, CustomStringConvertible {
2424
return self.unName
2525
}
2626

27-
var hashValue : Int {
28-
return self.unName.hashValue
27+
func hash(into hasher: inout Hasher) {
28+
hasher.combine(unName)
2929
}
3030

3131
static func == (l : Name, r : Name) -> Bool {

0 commit comments

Comments
 (0)