-
Notifications
You must be signed in to change notification settings - Fork 10.5k
stdlib: Remove Collection.randomElement customization point. #17637
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
stdlib: Remove Collection.randomElement customization point. #17637
Conversation
@swift-ci Please test |
@swift-ci Please test source compatibility |
I don't believe this would pass the tests. You're going to need to move the implementation from |
OK, thanks! |
75727ac
to
21db37d
Compare
@swift-ci Please test |
Build failed |
As proposed and accepted in amendment swiftlang/swift-evolution#863. rdar://problem/41067949
21db37d
to
04b5174
Compare
@swift-ci Please test |
Build failed |
Build failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return Self(truncatingIfNeeded: generator.next() as Magnitude) | ||
} | ||
// Need to widen delta to account for the right-endpoint of a closed range. | ||
delta += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephentyrone It looks like the optimizer does figure out that it is not necessary to check for the overflow, because you did it manually in the if
block above… but still, wouldn't it make sense to go with delta &+= 1
here?
As proposed and accepted in amendment swiftlang/swift-evolution#863. rdar://problem/41067949