diff --git a/lib/AST/GenericSignatureBuilder.cpp b/lib/AST/GenericSignatureBuilder.cpp index 18c589cc3af78..6d649c9ea6b7f 100644 --- a/lib/AST/GenericSignatureBuilder.cpp +++ b/lib/AST/GenericSignatureBuilder.cpp @@ -4211,6 +4211,15 @@ static void computeDerivedSameTypeComponents( assert(componentOf.count(concrete.archetype) > 0); auto &component = components[componentOf[concrete.archetype]]; + // FIXME: Skip self-derived sources. This means our attempts to "stage" + // construction of self-derived sources really don't work, because we + // discover more information later, so we need a more on-line or + // iterative approach. + bool derivedViaConcrete; + if (concrete.source->isSelfDerivedSource(concrete.archetype, + derivedViaConcrete)) + continue; + // If it has a better source than we'd seen before for this component, // keep it. auto &bestConcreteTypeSource = component.concreteTypeSource; diff --git a/stdlib/private/StdlibCollectionUnittest/CheckCollectionType.swift.gyb b/stdlib/private/StdlibCollectionUnittest/CheckCollectionType.swift.gyb index 77078aa39f224..8ce20401e2788 100644 --- a/stdlib/private/StdlibCollectionUnittest/CheckCollectionType.swift.gyb +++ b/stdlib/private/StdlibCollectionUnittest/CheckCollectionType.swift.gyb @@ -480,7 +480,6 @@ internal enum _SubSequenceSubscriptOnRangeMode { CollectionWithEquatableElement : %(protocol)s, %(subseq_as_collection)s C.SubSequence : %(protocol)s, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : %(protocol)s, CollectionWithEquatableElement.Iterator.Element : Equatable ''' % locals() diff --git a/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb b/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb index a5a35d8dca425..ada6069fadeea 100644 --- a/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb +++ b/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb @@ -122,7 +122,6 @@ extension TestSuite { collectionIsBidirectional: Bool = false ) where C.SubSequence : MutableCollection, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : Collection, CollectionWithEquatableElement.Iterator.Element : Equatable, CollectionWithComparableElement.Iterator.Element : Comparable { @@ -785,7 +784,6 @@ self.test("\(testNamePrefix).partition/InvalidOrderings") { isFixedLengthCollection: Bool ) where C.SubSequence : BidirectionalCollection & MutableCollection, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : BidirectionalCollection, CollectionWithEquatableElement.Iterator.Element : Equatable, CollectionWithComparableElement.Iterator.Element : Comparable { @@ -932,7 +930,6 @@ self.test("\(testNamePrefix).partition/DispatchesThrough_withUnsafeMutableBuffer isFixedLengthCollection: Bool ) where C.SubSequence : RandomAccessCollection & MutableCollection, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : RandomAccessCollection, CollectionWithEquatableElement.Iterator.Element : Equatable, CollectionWithComparableElement.Iterator.Element : Comparable { diff --git a/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableCollectionType.swift b/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableCollectionType.swift index d76ed3c215ff3..14363c64c71c1 100644 --- a/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableCollectionType.swift +++ b/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableCollectionType.swift @@ -463,7 +463,6 @@ extension TestSuite { collectionIsBidirectional: Bool = false ) where C.SubSequence : Collection, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : Collection, CollectionWithEquatableElement.Iterator.Element : Equatable, CollectionWithEquatableElement.SubSequence : Collection { @@ -1182,7 +1181,6 @@ self.test("\(testNamePrefix).OperatorPlus") { outOfBoundsIndexOffset: Int = 1 ) where C.SubSequence : BidirectionalCollection & RangeReplaceableCollection, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : BidirectionalCollection, CollectionWithEquatableElement.Iterator.Element : Equatable { @@ -1305,7 +1303,6 @@ self.test("\(testNamePrefix).removeLast(n: Int)/whereIndexIsBidirectional/remove outOfBoundsIndexOffset: Int = 1 ) where C.SubSequence : RandomAccessCollection & RangeReplaceableCollection, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : RandomAccessCollection, CollectionWithEquatableElement.Iterator.Element : Equatable { diff --git a/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb b/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb index ef6967fbce503..e904e7e7b303a 100644 --- a/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb +++ b/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb @@ -367,7 +367,6 @@ public func expect${Mutable}CollectionType( X.SubSequence : Collection, % end // X.SubSequence.Indices == X.Indices, // FIXME(ABI)#3 (Recursive Protocol Constraints): can't have this constraint now. - X.SubSequence.SubSequence == X.SubSequence, X.Indices : Collection {} % end @@ -411,7 +410,6 @@ public func expectCollectionAssociatedTypes( // the 'where' clause, all of these should be required by the protocol. X.SubSequence : Collection, // X.SubSequence.Indices == X.Indices, // FIXME(ABI)#7 (Recursive Protocol Constraints): can't have this constraint now. - X.SubSequence.SubSequence == X.SubSequence, X.Indices : Collection {} /// Check that all associated types of a `BidirectionalCollection` are what we @@ -428,7 +426,6 @@ public func expectBidirectionalCollectionAssociatedTypes where Self.SubSequence.Index == Index, - Self.Iterator.Element == Self.SubSequence.Iterator.Element + Self.Iterator.Element == Self.SubSequence.Iterator.Element, + SubSequence.SubSequence == SubSequence // FIXME(ABI)#98 (Recursive Protocol Constraints): // FIXME(ABI)#99 (Associated Types with where clauses): // associatedtype SubSequence : Collection // where - // , // SubSequence.Indices == Indices, - // SubSequence.SubSequence == SubSequence // // ( Implement recursive protocol // constraints) diff --git a/stdlib/public/core/ExistentialCollection.swift.gyb b/stdlib/public/core/ExistentialCollection.swift.gyb index 8b8db4c54b432..6cdb79d3c19cb 100644 --- a/stdlib/public/core/ExistentialCollection.swift.gyb +++ b/stdlib/public/core/ExistentialCollection.swift.gyb @@ -430,13 +430,11 @@ internal final class _${Kind}Box : _Any${Kind}Box C.SubSequence : ${SubProtocol}, C.SubSequence.Iterator.Element == Element, C.SubSequence.Indices : ${SubProtocol}, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : ${SubProtocol} { // Traversal: ${Traversal} diff --git a/stdlib/public/core/LazyCollection.swift.gyb b/stdlib/public/core/LazyCollection.swift.gyb index 7bc7519aa165e..76e50cb57b27a 100644 --- a/stdlib/public/core/LazyCollection.swift.gyb +++ b/stdlib/public/core/LazyCollection.swift.gyb @@ -163,8 +163,8 @@ extension ${Self} : ${TraversalCollection} { /// /// - Complexity: O(1) @_inlineable - public subscript(bounds: Range) -> ${Self}<${Slice}> { - return ${Slice}(base: _base, bounds: bounds).lazy + public subscript(bounds: Range) -> ${Slice}<${Self}> { + return ${Slice}(base: self, bounds: bounds) } /// A Boolean value indicating whether the collection is empty. diff --git a/stdlib/public/core/Mirror.swift b/stdlib/public/core/Mirror.swift index b689a29e67b55..c2d319e7ea5fc 100644 --- a/stdlib/public/core/Mirror.swift +++ b/stdlib/public/core/Mirror.swift @@ -220,7 +220,6 @@ public struct Mirror { // associated types of Collection. C.SubSequence : Collection, C.SubSequence.Indices : Collection, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : Collection { self.subjectType = Subject.self @@ -272,7 +271,6 @@ public struct Mirror { // FIXME(ABI)#48 (Associated Types with where clauses): these constraints should be applied to // associated types of Collection. C.SubSequence : Collection, - C.SubSequence.SubSequence == C.SubSequence, C.Indices : Collection { self.subjectType = Subject.self