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

[SE-0157] Standard library uses of Recursive Protocol Constraints #11923

Merged

Commits on Oct 1, 2017

  1. [Sequence] Make Sequence.SubSequence conform to Sequence.

    Addressed ABI FIXME’s #4, apple#5, apple#104 and apple#105, making Sequence’s
    SubSequence conform to Sequence, with the same element type, and for
    which the SubSequence of a SubSequence is the same SubSequence.
    
    Fixes SR-318 / rdar://problem/31418206.
    DougGregor committed Oct 1, 2017
    Configuration menu
    Copy the full SHA
    e5f893b View commit details
    Browse the repository at this point in the history
  2. [SE-0157] Make *Collection.SubSequence conform to corresponding *Coll…

    …ection.
    
    Introduce (recursive) constraints that make the *Collection constraint
    of SubSequence match that of its enclosing *Collection, e.g.,
    MutableCollection.SubSequence conforms to MutableCollection.
    
    Fixes rdar://problem/20715031 and more of SR-3453.
    DougGregor committed Oct 1, 2017
    Configuration menu
    Copy the full SHA
    6b51806 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4457264 View commit details
    Browse the repository at this point in the history
  4. [Collections] Constrain Indices type to Collection.

    Make the Indices types conform to the appropriate Collection protocol:
    * Collection.Indices: Collection
    * BidirectionalCollection.Indices: BidirectionalCollection
    * RandomAccessCollection.Indices: RandomAccessCollection
    DougGregor committed Oct 1, 2017
    Configuration menu
    Copy the full SHA
    52eb618 View commit details
    Browse the repository at this point in the history
  5. Use Collection protocols in IndexingIterator and Default*Indices cons…

    …traints.
    
    Eliminates a few explicit uses of the Indexable protocols.
    DougGregor committed Oct 1, 2017
    Configuration menu
    Copy the full SHA
    af48bdc View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9d2c9be View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    31ad22d View commit details
    Browse the repository at this point in the history
  8. Use a more efficient SubSequence type for lazy map and filter.

    Rather than using the default slice type when slicing the collection produced
    by a lazy map or filter, slice the base collection and form a new
    lazy map/filter collection from it. This allows any optimizations provided by
    the collection SubSequence type to kick in, as well as ensuring that slicing
    a lazy collection provides the same type as producing a lazy collection of a
    slice.
    
    This is technically source-breaking, because someone could have spelled out
    the types of slicing a lazy filter or map… but it seems unlikely to matter
    in practice and the benefits could be significant.
    
    Fixes ABI FIXME’s apple#28 and apple#46.
    DougGregor committed Oct 1, 2017
    Configuration menu
    Copy the full SHA
    fb253b1 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    42968b2 View commit details
    Browse the repository at this point in the history
  10. Eliminate the _*Indexable protocols.

    The various _*Indexable protocols only exist to work around the lack of
    recursive protocol constraints. Eliminate all of the *_Indexable protocols,
    collapsing their requirements into the corresponding Collection protocol
    (e.g., _MutableIndexable —> Collection).
    
    This introduces a number of extraneous requirements into the various
    Collection protocols to work around bugs in associated type
    inference. Specifically, to work around the lack of "global" inference
    of associated type witnesses. These hacks were implicitly present in
    the *Indexable protocols; I've made marked them as ABI FIXMEs here so
    we can remove them when associated type inference improves.
    
    Fixes rdar://problem/21935030 and a number of ABI FIXMEs in the library.
    DougGregor committed Oct 1, 2017
    Configuration menu
    Copy the full SHA
    797df6e View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    772352e View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2017

  1. Configuration menu
    Copy the full SHA
    5db9b11 View commit details
    Browse the repository at this point in the history