Skip to content

Commit a9bffa0

Browse files
author
Max Moiseev
committed
[stdlib] Only deprecate flatMap starting with Swift 4.1
Fixes: https://bugs.swift.org/browse/SR-6970 and rdar://problem/37393816 (cherry picked from commit 2670874)
1 parent 533f2e9 commit a9bffa0

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

stdlib/public/core/FlatMap.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ extension LazySequenceProtocol {
6060
///
6161
/// - Complexity: O(1)
6262
@inline(__always)
63-
@available(*, deprecated, renamed: "compactMap(_:)",
63+
@available(swift, deprecated: 4.1, renamed: "compactMap(_:)",
6464
message: "Please use compactMap(_:) for the case where closure returns an optional value")
6565
public func flatMap<ElementOfResult>(
6666
_ transform: @escaping (Elements.Element) -> ElementOfResult?
@@ -124,7 +124,7 @@ extension LazyCollectionProtocol {
124124
/// collection as its argument and returns an optional value.
125125
///
126126
/// - Complexity: O(1)
127-
@available(*, deprecated, renamed: "compactMap(_:)",
127+
@available(swift, deprecated: 4.1, renamed: "compactMap(_:)",
128128
message: "Please use compactMap(_:) for the case where closure returns an optional value")
129129
@_inlineable // FIXME(sil-serialize-all)
130130
public func flatMap<ElementOfResult>(

stdlib/public/core/SequenceAlgorithms.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ extension Sequence {
783783
/// - Complexity: O(*m* + *n*), where *m* is the length of this sequence
784784
/// and *n* is the length of the result.
785785
@inline(__always)
786-
@available(*, deprecated, renamed: "compactMap(_:)",
786+
@available(swift, deprecated: 4.1, renamed: "compactMap(_:)",
787787
message: "Please use compactMap(_:) for the case where closure returns an optional value")
788788
public func flatMap<ElementOfResult>(
789789
_ transform: (Element) throws -> ElementOfResult?

stdlib/public/core/StringRangeReplaceableCollection.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ extension Collection {
448448
return try _compactMap(transform)
449449
}
450450

451-
@available(*, deprecated, renamed: "compactMap(_:)",
451+
@available(swift, deprecated: 4.1, renamed: "compactMap(_:)",
452452
message: "Please use compactMap(_:) for the case where closure returns an optional value")
453453
@inline(__always)
454454
public func flatMap(

test/stdlib/FlatMapDeprecation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift %s
1+
// RUN: %swift -swift-version 4 -typecheck -verify %s
22

33
func flatMapOnSequence<
44
S : Sequence

0 commit comments

Comments
 (0)