Does not compile under Swift 4.1 - Easy Fix

#51 · closed · 1 comments

View on GitHub ↗

alexpopov

In `Collection+RandomKit` the extension on line 81 containing `uncheckedRandom(in:using)` fails to compile because in Swift 4.1 `IndexDistance` is now always `Int` and the compiler sees it as an invalid redeclaration. Fix: the whole extensions can be removed. Similarly in the following extension on line 90, `IndexDistance` is used as a generic constraint but it is no longer generic (since it's always `Int`). Additionally, a warning is issued on line 96 since `IndexDistance` is deprecated. Fix: removing the `IndexDistance` constraint and optionally resolve the warning. All macOS tests pass with these changes. As easy as these fixes are, I'm not sure how to submit a PR since this probably shouldn't be merged into master without mention in the README regarding which version to use in dependency managers depending on the Swift version being used.

Comments

alexpopov

Actually, I see that this is enclosed in an `#if swift` block, so I don't know why Carthage is compiling it on my machine. Sorry.