nvzqz/RandomKit

RandomKit does not compile with Xcode 9.0

NachoSoto opened this issue · 10 comments

/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomRawRepresentable.swift:41:20: warning: redeclaration of associated type 'RawValue' from protocol 'RawRepresentable' is better expressed as a 'where' clause on the protocol
    associatedtype RawValue: Random
    ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
    
Swift.RawRepresentable:96:20: note: 'RawValue' declared here
    associatedtype RawValue
                   ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomGenerator/Seedable.swift:131:37: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func reseeding<R: RandomGenerator>(with reseeder: R) -> ReseedingRandomGenerator<Self, R> {
                                    ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomGenerator/Seedable.swift:131:75: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func reseeding<R: RandomGenerator>(with reseeder: R) -> ReseedingRandomGenerator<Self, R> {
                                                                          ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomThroughValue.swift:74:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(through value: Self, using randomGenerator: inout R) -> RandomsThroughValue<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomThroughValue.swift:74:108: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(through value: Self, using randomGenerator: inout R) -> RandomsThroughValue<Self, R> {
                                                                                                           ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomThroughValue.swift:79:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, through value: Self, using randomGenerator: inout R) -> LimitedRandomsThroughValue<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomThroughValue.swift:79:130: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, through value: Self, using randomGenerator: inout R) -> LimitedRandomsThroughValue<Self, R> {
                                                                                                                                 ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomToValue.swift:74:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(to value: Self, using randomGenerator: inout R) -> RandomsToValue<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomToValue.swift:74:103: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(to value: Self, using randomGenerator: inout R) -> RandomsToValue<Self, R> {
                                                                                                      ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomToValue.swift:79:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, to value: Self, using randomGenerator: inout R) -> LimitedRandomsToValue<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomToValue.swift:79:125: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, to value: Self, using randomGenerator: inout R) -> LimitedRandomsToValue<Self, R> {
                                                                                                                            ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomGenerator/ThreadLocal.swift:138:48: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func threadLocalReseeding<R: RandomGenerator>(
                                               ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomGenerator/ThreadLocal.swift:141:10: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    ) -> UnsafeMutablePointer<ReseedingRandomGenerator<Self, R>> {
         ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomGenerator/ThreadLocal.swift:177:52: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func withThreadLocalReseeding<R: RandomGenerator, T>(
                                                   ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomGenerator/ThreadLocal.swift:180:17: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
        _ body: (inout ReseedingRandomGenerator<Self, R>) throws -> T
                ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/Random.swift:53:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(using randomGenerator: inout R) -> Randoms<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/Random.swift:53:87: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(using randomGenerator: inout R) -> Randoms<Self, R> {
                                                                                      ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/Random.swift:58:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, using randomGenerator: inout R) -> LimitedRandoms<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/Random.swift:58:109: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, using randomGenerator: inout R) -> LimitedRandoms<Self, R> {
                                                                                                            ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomInRange.swift:81:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(in range: Range<Self>, using randomGenerator: inout R) -> RandomsWithinRange<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomInRange.swift:81:110: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(in range: Range<Self>, using randomGenerator: inout R) -> RandomsWithinRange<Self, R> {
                                                                                                             ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomInRange.swift:86:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, in range: Range<Self>, using randomGenerator: inout R) -> LimitedRandomsWithinRange<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomInRange.swift:86:132: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, in range: Range<Self>, using randomGenerator: inout R) -> LimitedRandomsWithinRange<Self, R> {
                                                                                                                                   ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomInClosedRange.swift:63:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(in closedRange: ClosedRange<Self>, using randomGenerator: inout R) -> RandomsWithinClosedRange<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomInClosedRange.swift:63:122: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(in closedRange: ClosedRange<Self>, using randomGenerator: inout R) -> RandomsWithinClosedRange<Self, R> {
                                                                                                                         ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomInClosedRange.swift:68:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, in closedRange: ClosedRange<Self>, using randomGenerator: inout R) -> LimitedRandomsWithinClosedRange<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomInClosedRange.swift:68:144: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, in closedRange: ClosedRange<Self>, using randomGenerator: inout R) -> LimitedRandomsWithinClosedRange<Self, R> {
                                                                                                                                               ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomWithMaxWidth.swift:53:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(withMaxWidth width: Int, using randomGenerator: inout R) -> RandomsWithMaxWidth<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomWithMaxWidth.swift:53:112: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(withMaxWidth width: Int, using randomGenerator: inout R) -> RandomsWithMaxWidth<Self, R> {
                                                                                                               ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomWithMaxWidth.swift:58:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, withMaxWidth width: Int, using randomGenerator: inout R) -> LimitedRandomsWithMaxWidth<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomWithMaxWidth.swift:58:134: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, withMaxWidth width: Int, using randomGenerator: inout R) -> LimitedRandomsWithMaxWidth<Self, R> {
                                                                                                                                     ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomWithExactWidth.swift:53:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(withExactWidth width: Int, using randomGenerator: inout R) -> RandomsWithExactWidth<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomWithExactWidth.swift:53:114: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(withExactWidth width: Int, using randomGenerator: inout R) -> RandomsWithExactWidth<Self, R> {
                                                                                                                 ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomWithExactWidth.swift:58:35: warning: redundant conformance constraint 'R': 'RandomGenerator'
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, withExactWidth width: Int, using randomGenerator: inout R) -> LimitedRandomsWithExactWidth<Self, R> {
                                  ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Types/RandomWithExactWidth.swift:58:136: note: conformance constraint 'R': 'RandomGenerator' inferred from type here
    public static func randoms<R: RandomGenerator>(limitedBy limit: Int, withExactWidth width: Int, using randomGenerator: inout R) -> LimitedRandomsWithExactWidth<Self, R> {
                                                                                                                                       ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Extensions/Swift/Integer+RandomKit.swift:237:64: error: binary operator '&-' cannot be applied to two 'Self' operands
        return range.lowerBound &+ random(to: range.upperBound &- range.lowerBound, using: &randomGenerator)
                                              ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Extensions/Swift/Integer+RandomKit.swift:237:64: note: expected an argument list of type '(Self, Self)'
        return range.lowerBound &+ random(to: range.upperBound &- range.lowerBound, using: &randomGenerator)
                                                               ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Extensions/Swift/Integer+RandomKit.swift:270:45: error: binary operator '&+' cannot be applied to operands of type 'Self' and 'Int'
            return _randomGreater(to: value &+ 1, using: &randomGenerator)
                                      ~~~~~ ^  ~
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Extensions/Swift/Integer+RandomKit.swift:270:45: note: expected an argument list of type '(Self, Self)'
            return _randomGreater(to: value &+ 1, using: &randomGenerator)
                                            ^
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Extensions/Swift/Integer+RandomKit.swift:293:44: error: binary operator '&-' cannot be applied to two 'Self' operands
        let bound = closedRange.upperBound &- closedRange.lowerBound
                    ~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~
/Users/nachosoto/dev/ios/AsyncImageView/Carthage/Checkouts/RandomKit/Sources/RandomKit/Extensions/Swift/Integer+RandomKit.swift:293:44: note: expected an argument list of type '(Self, Self)'
        let bound = closedRange.upperBound &- closedRange.lowerBound
                                           ^
nvzqz commented

What Swift version are you compiling with?

The Swift 4.0 version included in Xcode 9.0.

nvzqz commented

Try compiling from master. It's updated for Swift 4.

This is compiling master (commit 532c82a).

@nvzqz you misunderstood me: this issue HAPPENS compiling commit 532c82a.

nvzqz commented

Do you know which Swift 4 version this breaks on? Date-wise

Also, can I not get Xcode 9 with a free dev account?

I don't know what version this broke on, but Xcode 9 has Swift 4.0 (900.0.43).

nvzqz commented

Just compiled successfully on 6/1/17. Gonna try the latest version.

Also works on 6/2/17. Gonna try Trunk Development (6/4/17).

Also works on Trunk Development.

Try compiling b7ffe2a

Ran it in Xcode 9, got the same errors as you. This seems to be due to the compiler ignoring the #if swift(>=4) parts.

Found the problem: Xcode 9 uses Swift 3.2 (didn't know that even existed). As a result, some parts don't work as expected.

Thanks!

nvzqz commented

@NachoSoto Released v5.1.0 which supports Swift 3.2 and 4