diff --git a/stdlib/public/Concurrency/Clock.swift b/stdlib/public/Concurrency/Clock.swift index e05ca3c4e5a3c..ad3ed884fd222 100644 --- a/stdlib/public/Concurrency/Clock.swift +++ b/stdlib/public/Concurrency/Clock.swift @@ -31,7 +31,7 @@ import Swift /// For more information about specific clocks see `ContinuousClock` and /// `SuspendingClock`. @available(SwiftStdlib 5.7, *) -public protocol Clock: Sendable { +public protocol Clock: Sendable { associatedtype Duration associatedtype Instant: InstantProtocol where Instant.Duration == Duration diff --git a/stdlib/public/core/BidirectionalCollection.swift b/stdlib/public/core/BidirectionalCollection.swift index 6342bf90ebe7d..61cc712b459f5 100644 --- a/stdlib/public/core/BidirectionalCollection.swift +++ b/stdlib/public/core/BidirectionalCollection.swift @@ -39,7 +39,7 @@ /// Valid indices are exactly those indices that are reachable from the /// collection's `startIndex` by repeated applications of `index(after:)`, up /// to, and including, the `endIndex`. -public protocol BidirectionalCollection: Collection +public protocol BidirectionalCollection: Collection where SubSequence: BidirectionalCollection, Indices: BidirectionalCollection { // FIXME: Only needed for associated type inference. override associatedtype Element diff --git a/stdlib/public/core/Collection.swift b/stdlib/public/core/Collection.swift index eda2c94440101..dce77ab73990d 100644 --- a/stdlib/public/core/Collection.swift +++ b/stdlib/public/core/Collection.swift @@ -335,7 +335,7 @@ extension IndexingIterator: Sendable /// or bidirectional collection must traverse the entire collection to count /// the number of contained elements, accessing its `count` property is an /// O(*n*) operation. -public protocol Collection: Sequence { +public protocol Collection: Sequence { // FIXME: ideally this would be in MigrationSupport.swift, but it needs // to be on the protocol instead of as an extension @available(*, deprecated/*, obsoleted: 5.0*/, message: "all index distances are now of type Int") diff --git a/stdlib/public/core/CompilerProtocols.swift b/stdlib/public/core/CompilerProtocols.swift index a3f72b547fad3..b749b791191a1 100644 --- a/stdlib/public/core/CompilerProtocols.swift +++ b/stdlib/public/core/CompilerProtocols.swift @@ -98,7 +98,7 @@ /// // Prints "false" /// print(allowedMoves.rawValue & Directions.right.rawValue) /// // Prints "0" -public protocol RawRepresentable { +public protocol RawRepresentable { /// The raw type that can be used to represent all values of the conforming /// type. /// diff --git a/stdlib/public/core/Identifiable.swift b/stdlib/public/core/Identifiable.swift index 876007a62521f..731801700b99e 100644 --- a/stdlib/public/core/Identifiable.swift +++ b/stdlib/public/core/Identifiable.swift @@ -39,7 +39,7 @@ /// lifetime of an object. If an object has a stronger notion of identity, it /// may be appropriate to provide a custom implementation. @available(SwiftStdlib 5.1, *) -public protocol Identifiable { +public protocol Identifiable { /// A type representing the stable identity of the entity associated with /// an instance. diff --git a/stdlib/public/core/Instant.swift b/stdlib/public/core/Instant.swift index dc0955d5e5fb0..baec28e430320 100644 --- a/stdlib/public/core/Instant.swift +++ b/stdlib/public/core/Instant.swift @@ -12,7 +12,7 @@ // A type that defines a specific point in time for a given `Clock`. @available(SwiftStdlib 5.7, *) -public protocol InstantProtocol: Comparable, Hashable, Sendable { +public protocol InstantProtocol: Comparable, Hashable, Sendable { associatedtype Duration: DurationProtocol func advanced(by duration: Duration) -> Self func duration(to other: Self) -> Duration diff --git a/stdlib/public/core/LazyCollection.swift b/stdlib/public/core/LazyCollection.swift index c84027f34614d..7eb0d53d4b4b9 100644 --- a/stdlib/public/core/LazyCollection.swift +++ b/stdlib/public/core/LazyCollection.swift @@ -10,8 +10,8 @@ // //===----------------------------------------------------------------------===// -public protocol LazyCollectionProtocol: Collection, LazySequenceProtocol -where Elements: Collection { } +public protocol LazyCollectionProtocol: Collection, LazySequenceProtocol +where Elements: Collection {} extension LazyCollectionProtocol { // Lazy things are already lazy diff --git a/stdlib/public/core/LazySequence.swift b/stdlib/public/core/LazySequence.swift index 43ade83501548..e0d25d3b92357 100644 --- a/stdlib/public/core/LazySequence.swift +++ b/stdlib/public/core/LazySequence.swift @@ -138,11 +138,8 @@ public protocol LazySequenceProtocol: Sequence { /// A sequence containing the same elements as this one, possibly with /// a simpler type. /// - /// When implementing lazy operations, wrapping `elements` instead - /// of `self` can prevent result types from growing an extra - /// `LazySequence` layer. For example, - /// - /// _prext_ example needed + /// When implementing lazy operations, wrapping `elements` instead of `self` + /// can prevent result types from growing an extra `LazySequence` layer. /// /// Note: this property need not be implemented by conforming types, /// it has a default implementation in a protocol extension that diff --git a/stdlib/public/core/MutableCollection.swift b/stdlib/public/core/MutableCollection.swift index 2c13da536495f..5b0657799a109 100644 --- a/stdlib/public/core/MutableCollection.swift +++ b/stdlib/public/core/MutableCollection.swift @@ -57,7 +57,7 @@ /// // Must be equivalent to: /// a[i] = x /// let y = x -public protocol MutableCollection: Collection +public protocol MutableCollection: Collection where SubSequence: MutableCollection { // FIXME: Associated type inference requires these. diff --git a/stdlib/public/core/RandomAccessCollection.swift b/stdlib/public/core/RandomAccessCollection.swift index ced1d9d749b50..0ac96e36d1767 100644 --- a/stdlib/public/core/RandomAccessCollection.swift +++ b/stdlib/public/core/RandomAccessCollection.swift @@ -30,7 +30,7 @@ /// collection, either the index for your custom type must conform to the /// `Strideable` protocol or you must implement the `index(_:offsetBy:)` and /// `distance(from:to:)` methods with O(1) efficiency. -public protocol RandomAccessCollection: BidirectionalCollection +public protocol RandomAccessCollection: BidirectionalCollection where SubSequence: RandomAccessCollection, Indices: RandomAccessCollection { // FIXME: Associated type inference requires these. diff --git a/stdlib/public/core/Range.swift b/stdlib/public/core/Range.swift index 094d33c3fc416..dd368177f61b1 100644 --- a/stdlib/public/core/Range.swift +++ b/stdlib/public/core/Range.swift @@ -14,7 +14,7 @@ /// /// A type that conforms to `RangeExpression` can convert itself to a /// `Range` of indices within a given collection. -public protocol RangeExpression { +public protocol RangeExpression { /// The type for which the expression describes a range. associatedtype Bound: Comparable diff --git a/stdlib/public/core/RangeReplaceableCollection.swift b/stdlib/public/core/RangeReplaceableCollection.swift index b09244b1bf8e2..8e592f7082617 100644 --- a/stdlib/public/core/RangeReplaceableCollection.swift +++ b/stdlib/public/core/RangeReplaceableCollection.swift @@ -61,8 +61,8 @@ /// `replaceSubrange(_:with:)` with an empty collection for the `newElements` /// parameter. You can override any of the protocol's required methods to /// provide your own custom implementation. -public protocol RangeReplaceableCollection: Collection - where SubSequence: RangeReplaceableCollection { +public protocol RangeReplaceableCollection: Collection +where SubSequence: RangeReplaceableCollection { // FIXME: Associated type inference requires this. override associatedtype SubSequence diff --git a/stdlib/public/core/SIMDVector.swift b/stdlib/public/core/SIMDVector.swift index 951b699faf255..7e0522a3cb296 100644 --- a/stdlib/public/core/SIMDVector.swift +++ b/stdlib/public/core/SIMDVector.swift @@ -72,11 +72,13 @@ public protocol SIMDScalar { } /// A SIMD vector of a fixed number of elements. -public protocol SIMD: SIMDStorage, - Codable, - Hashable, - CustomStringConvertible, - ExpressibleByArrayLiteral { +public protocol SIMD: + SIMDStorage, + Codable, + Hashable, + CustomStringConvertible, + ExpressibleByArrayLiteral +{ /// The mask type resulting from pointwise comparisons of this vector type. associatedtype MaskStorage: SIMD where MaskStorage.Scalar: FixedWidthInteger & SignedInteger diff --git a/stdlib/public/core/Sequence.swift b/stdlib/public/core/Sequence.swift index 3df5231d0a5ef..35305ea79bdef 100644 --- a/stdlib/public/core/Sequence.swift +++ b/stdlib/public/core/Sequence.swift @@ -174,7 +174,7 @@ /// // Prints "3..." /// // Prints "2..." /// // Prints "1..." -public protocol IteratorProtocol { +public protocol IteratorProtocol { /// The type of element traversed by the iterator. associatedtype Element @@ -322,7 +322,7 @@ public protocol IteratorProtocol { /// makes no other requirements about element access, so routines that /// traverse a sequence should be considered O(*n*) unless documented /// otherwise. -public protocol Sequence { +public protocol Sequence { /// A type representing the sequence's elements. associatedtype Element diff --git a/stdlib/public/core/SetAlgebra.swift b/stdlib/public/core/SetAlgebra.swift index a7c206af3213f..e9cf5a92290a7 100644 --- a/stdlib/public/core/SetAlgebra.swift +++ b/stdlib/public/core/SetAlgebra.swift @@ -52,7 +52,7 @@ /// - `x.isStrictSuperset(of: y)` if and only if /// `x.isSuperset(of: y) && x != y` /// - `x.isStrictSubset(of: y)` if and only if `x.isSubset(of: y) && x != y` -public protocol SetAlgebra: Equatable, ExpressibleByArrayLiteral { +public protocol SetAlgebra: Equatable, ExpressibleByArrayLiteral { /// A type for which the conforming type provides a containment test. associatedtype Element diff --git a/stdlib/public/core/Stride.swift b/stdlib/public/core/Stride.swift index 8d20c613f9825..f269d3eca9552 100644 --- a/stdlib/public/core/Stride.swift +++ b/stdlib/public/core/Stride.swift @@ -96,7 +96,7 @@ /// `Stride` type's implementations. If a type conforming to `Strideable` is /// its own `Stride` type, it must provide concrete implementations of the /// two operators to avoid infinite recursion. -public protocol Strideable: Comparable { +public protocol Strideable: Comparable { /// A type that represents the distance between two values. associatedtype Stride: SignedNumeric, Comparable