-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.standard libraryArea: Standard library umbrellaArea: Standard library umbrella
Description
Previous ID | SR-13937 |
Radar | None |
Original Reporter | @dabrahams |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | Standard Library |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 79626c31d137f57975f0b894a587bfcd
Issue Description:
The precondition in Collection.distance
that reads “Only BidirectionalCollections can have end come before start” fires even for {{BidirectionalCollection}} models unless the implementor of the collection is hyper-vigilant and implements their own distance method.
We could solve this problem by adding a default implementation of distance for BidirectionalCollections, but we're already doing a test/branch even on collections that are non-bidirectional, to detect the precondition violation. We might as well just do the right thing in all cases.
#34981 takes a first crack at an implementation.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.standard libraryArea: Standard library umbrellaArea: Standard library umbrella