Skip to content

[5.0][stdlib] Only deprecate flatMap starting with Swift 4.1 #14642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stdlib/public/core/FlatMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extension LazySequenceProtocol {
///
/// - Complexity: O(1)
@inline(__always)
@available(*, deprecated, renamed: "compactMap(_:)",
@available(swift, deprecated: 4.1, renamed: "compactMap(_:)",
message: "Please use compactMap(_:) for the case where closure returns an optional value")
public func flatMap<ElementOfResult>(
_ transform: @escaping (Elements.Element) -> ElementOfResult?
Expand Down Expand Up @@ -124,7 +124,7 @@ extension LazyCollectionProtocol {
/// collection as its argument and returns an optional value.
///
/// - Complexity: O(1)
@available(*, deprecated, renamed: "compactMap(_:)",
@available(swift, deprecated: 4.1, renamed: "compactMap(_:)",
message: "Please use compactMap(_:) for the case where closure returns an optional value")
@_inlineable // FIXME(sil-serialize-all)
public func flatMap<ElementOfResult>(
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/SequenceAlgorithms.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ extension Sequence {
/// - Complexity: O(*m* + *n*), where *m* is the length of this sequence
/// and *n* is the length of the result.
@inline(__always)
@available(*, deprecated, renamed: "compactMap(_:)",
@available(swift, deprecated: 4.1, renamed: "compactMap(_:)",
message: "Please use compactMap(_:) for the case where closure returns an optional value")
public func flatMap<ElementOfResult>(
_ transform: (Element) throws -> ElementOfResult?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ extension Collection {
return try _compactMap(transform)
}

@available(*, deprecated, renamed: "compactMap(_:)",
@available(swift, deprecated: 4.1, renamed: "compactMap(_:)",
message: "Please use compactMap(_:) for the case where closure returns an optional value")
@inline(__always)
public func flatMap(
Expand Down
2 changes: 1 addition & 1 deletion test/stdlib/FlatMapDeprecation.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift %s
// RUN: %swift -swift-version 4 -typecheck -verify %s

func flatMapOnSequence<
S : Sequence
Expand Down