Skip to content

Commit d30b05c

Browse files
committed
Mop up remaining "better expressed as a where clause" warnings
1 parent 25670b1 commit d30b05c

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

benchmark/single-source/PopFrontGeneric.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ let arrayCount = 1024
1919
// being really slow).
2020
@_versioned
2121
protocol MyArrayBufferProtocol : MutableCollection, RandomAccessCollection {
22-
associatedtype Element
23-
2422
mutating func myReplace<C>(
2523
_ subRange: Range<Int>,
2624
with newValues: C

stdlib/public/core/ArrayBufferProtocol.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ internal protocol _ArrayBufferProtocol
2121
: RandomAccessCollection
2222
= CountableRange<Int>
2323

24-
/// The type of elements stored in the buffer.
25-
associatedtype Element
26-
2724
/// Create an empty buffer.
2825
init()
2926

stdlib/public/core/SetAlgebra.swift

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -409,28 +409,6 @@ extension SetAlgebra {
409409
for e in sequence { insert(e) }
410410
}
411411

412-
/// Creates a set containing the elements of the given array literal.
413-
///
414-
/// Do not call this initializer directly. It is used by the compiler when
415-
/// you use an array literal. Instead, create a new set using an array
416-
/// literal as its value by enclosing a comma-separated list of values in
417-
/// square brackets. You can use an array literal anywhere a set is expected
418-
/// by the type context.
419-
///
420-
/// Here, a set of strings is created from an array literal holding only
421-
/// strings:
422-
///
423-
/// let ingredients: Set = ["cocoa beans", "sugar", "cocoa butter", "salt"]
424-
/// if ingredients.isSuperset(of: ["sugar", "salt"]) {
425-
/// print("Whatever it is, it's bound to be delicious!")
426-
/// }
427-
/// // Prints "Whatever it is, it's bound to be delicious!"
428-
///
429-
/// - Parameter arrayLiteral: A list of elements of the new set.
430-
public init(arrayLiteral: Element...) {
431-
self.init(arrayLiteral)
432-
}
433-
434412
/// Removes the elements of the given set from this set.
435413
///
436414
/// In the following example, the elements of the `employees` set that are
@@ -571,6 +549,30 @@ extension SetAlgebra {
571549
}
572550
}
573551

552+
extension SetAlgebra where Element == ArrayLiteralElement {
553+
/// Creates a set containing the elements of the given array literal.
554+
///
555+
/// Do not call this initializer directly. It is used by the compiler when
556+
/// you use an array literal. Instead, create a new set using an array
557+
/// literal as its value by enclosing a comma-separated list of values in
558+
/// square brackets. You can use an array literal anywhere a set is expected
559+
/// by the type context.
560+
///
561+
/// Here, a set of strings is created from an array literal holding only
562+
/// strings:
563+
///
564+
/// let ingredients: Set = ["cocoa beans", "sugar", "cocoa butter", "salt"]
565+
/// if ingredients.isSuperset(of: ["sugar", "salt"]) {
566+
/// print("Whatever it is, it's bound to be delicious!")
567+
/// }
568+
/// // Prints "Whatever it is, it's bound to be delicious!"
569+
///
570+
/// - Parameter arrayLiteral: A list of elements of the new set.
571+
public init(arrayLiteral: Element...) {
572+
self.init(arrayLiteral)
573+
}
574+
}
575+
574576
@available(*, unavailable, renamed: "SetAlgebra")
575577
public typealias SetAlgebraType = SetAlgebra
576578

0 commit comments

Comments
 (0)