Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type 'Collection.IndexDistance' (aka 'Int') in conformance requirement does not refer to a generic parameter or associated type #55

Open
hufkens opened this issue Apr 26, 2018 · 1 comment

Comments

@hufkens
Copy link

hufkens commented Apr 26, 2018

When using the latest Xcode (9.3) I get this error:

RandomKit/Sources/RandomKit/Extensions/Swift/Collection+RandomKit.swift:90:73: Type 'Collection.IndexDistance' (aka 'Int') in conformance requirement does not refer to a generic parameter or associated type

in:

extension Collection where Self: RandomRetrievableInRange, IndexDistance: RandomToValue {

    /// Returns a random element of `self`, or `nil` if `self` is empty.
    public func uncheckedRandom<R: RandomGenerator>(in range: Range<Index>, using randomGenerator: inout R) -> Iterator.Element {
        let upper = range.upperBound
        let lower = range.lowerBound
        let elementIndex = IndexDistance.random(to: distance(from: lower, to: upper), using: &randomGenerator)
        return self[index(lower, offsetBy: elementIndex)]
    }

}
@YUMUKIM
Copy link

YUMUKIM commented May 9, 2018

me too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants