Skip to content

Commit b3fa41b

Browse files
Dave AbrahamsMax Moiseev
authored andcommitted
[stdlib] Change Indexable deprecation messages
It's important to let people know that, in contrast with existing practice in other frameworks, we really are going to remove the deprecated API, and soon.
1 parent 130fb95 commit b3fa41b

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

stdlib/public/core/BidirectionalCollection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/// In most cases, it's best to ignore this protocol and use the
1717
/// `BidirectionalCollection` protocol instead, because it has a more complete
1818
/// interface.
19-
@available(*, deprecated, renamed: "BidirectionalCollection")
19+
@available(*, deprecated, message: "it will be removed in Swift 4.0. Please use 'BidirectionalCollection' instead")
2020
public protocol BidirectionalIndexable : Indexable {
2121
// FIXME(ABI)(compiler limitation): there is no reason for this protocol
2222
// to exist apart from missing compiler features that we emulate with it.

stdlib/public/core/Collection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
///
1616
/// In most cases, it's best to ignore this protocol and use the `Collection`
1717
/// protocol instead, because it has a more complete interface.
18-
@available(*, deprecated, renamed: "Collection")
18+
@available(*, deprecated, message: "it will be removed in Swift 4.0. Please use 'Collection' instead")
1919
public protocol IndexableBase {
2020
// FIXME(ABI)(compiler limitation): there is no reason for this protocol
2121
// to exist apart from missing compiler features that we emulate with it.
@@ -157,7 +157,7 @@ public protocol IndexableBase {
157157
///
158158
/// In most cases, it's best to ignore this protocol and use the `Collection`
159159
/// protocol instead, because it has a more complete interface.
160-
@available(*, deprecated, renamed: "Collection")
160+
@available(*, deprecated, message: "it will be removed in Swift 4.0. Please use 'Collection' instead")
161161
public protocol Indexable : IndexableBase {
162162
/// A type used to represent the number of steps between two indices, where
163163
/// one value is reachable from the other.

stdlib/public/core/MutableCollection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/// In most cases, it's best to ignore this protocol and use the
1616
/// `MutableCollection` protocol instead, because it has a more complete
1717
/// interface.
18-
@available(*, deprecated, renamed: "MutableCollection")
18+
@available(*, deprecated, message: "it will be removed in Swift 4.0. Please use 'MutableCollection' instead")
1919
public protocol MutableIndexable : Indexable {
2020
// FIXME(ABI)(compiler limitation): there is no reason for this protocol
2121
// to exist apart from missing compiler features that we emulate with it.

stdlib/public/core/RandomAccessCollection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/// In most cases, it's best to ignore this protocol and use the
1616
/// `RandomAccessCollection` protocol instead, because it has a more complete
1717
/// interface.
18-
@available(*, deprecated, renamed: "RandomAccessCollection")
18+
@available(*, deprecated, message: "it will be removed in Swift 4.0. Please use 'RandomAccessCollection' instead")
1919
public protocol RandomAccessIndexable : BidirectionalIndexable {
2020
// FIXME(ABI)(compiler limitation): there is no reason for this protocol
2121
// to exist apart from missing compiler features that we emulate with it.

stdlib/public/core/RangeReplaceableCollection.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/// In most cases, it's best to ignore this protocol and use the
2323
/// `RangeReplaceableCollection` protocol instead, because it has a more
2424
/// complete interface.
25-
@available(*, deprecated, renamed: "RangeReplaceableCollection")
25+
@available(*, deprecated, message: "it will be removed in Swift 4.0. Please use 'RandomAccessCollection' instead")
2626
public protocol RangeReplaceableIndexable : Indexable {
2727
// FIXME(ABI)(compiler limitation): there is no reason for this protocol
2828
// to exist apart from missing compiler features that we emulate with it.

validation-test/stdlib/CollectionDiagnostics.swift

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ func sortResultIgnored<
5454
array.sorted { $0 < $1 } // expected-warning {{result of call to 'sorted(by:)' is unused}}
5555
}
5656

57-
// expected-warning@+2 {{'Indexable' is deprecated: renamed to 'Collection'}}
58-
// expected-note@+1 {{use 'Collection' instead}}
57+
// expected-warning@+1 {{'Indexable' is deprecated: it will be removed in Swift 4.0. Please use 'Collection' instead}}
5958
struct GoodIndexable : Indexable {
6059
func index(after i: Int) -> Int { return i + 1 }
6160
var startIndex: Int { return 0 }
@@ -66,8 +65,7 @@ struct GoodIndexable : Indexable {
6665
}
6766

6867

69-
// expected-warning@+3 {{'Indexable' is deprecated: renamed to 'Collection'}}
70-
// expected-note@+2 {{use 'Collection' instead}}
68+
// expected-warning@+2 {{'Indexable' is deprecated: it will be removed in Swift 4.0. Please use 'Collection' instead}}
7169
// expected-error@+1 {{type 'BadIndexable1' does not conform to protocol 'IndexableBase'}}
7270
struct BadIndexable1 : Indexable {
7371
func index(after i: Int) -> Int { return i + 1 }
@@ -79,8 +77,7 @@ struct BadIndexable1 : Indexable {
7977
// Missing 'subscript(_:) -> SubSequence'.
8078
}
8179

82-
// expected-warning@+3 {{'Indexable' is deprecated: renamed to 'Collection'}}
83-
// expected-note@+2 {{use 'Collection' instead}}
80+
// expected-warning@+2 {{'Indexable' is deprecated: it will be removed in Swift 4.0. Please use 'Collection' instead}}
8481
// expected-error@+1 {{type 'BadIndexable2' does not conform to protocol 'IndexableBase'}}
8582
struct BadIndexable2 : Indexable {
8683
var startIndex: Int { return 0 }
@@ -91,8 +88,7 @@ struct BadIndexable2 : Indexable {
9188
// Missing index(after:) -> Int
9289
}
9390

94-
// expected-warning@+2 {{'BidirectionalIndexable' is deprecated: renamed to 'BidirectionalCollection'}}
95-
// expected-note@+1 {{use 'BidirectionalCollection' instead}}
91+
// expected-warning@+1 {{'BidirectionalIndexable' is deprecated: it will be removed in Swift 4.0. Please use 'BidirectionalCollection' instead}}
9692
struct GoodBidirectionalIndexable1 : BidirectionalIndexable {
9793
var startIndex: Int { return 0 }
9894
var endIndex: Int { return 0 }
@@ -105,8 +101,7 @@ struct GoodBidirectionalIndexable1 : BidirectionalIndexable {
105101

106102
// We'd like to see: {{type 'BadBidirectionalIndexable' does not conform to protocol 'BidirectionalIndexable'}}
107103
// But the compiler doesn't generate that error.
108-
// expected-warning@+2 {{'BidirectionalIndexable' is deprecated: renamed to 'BidirectionalCollection'}}
109-
// expected-note@+1 {{use 'BidirectionalCollection' instead}}
104+
// expected-warning@+1 {{'BidirectionalIndexable' is deprecated: it will be removed in Swift 4.0. Please use 'BidirectionalCollection' instead}}
110105
struct BadBidirectionalIndexable : BidirectionalIndexable {
111106
var startIndex: Int { return 0 }
112107
var endIndex: Int { return 0 }

0 commit comments

Comments
 (0)