Skip to content
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

[SR-6970] The flatMap() deprecation warning in Swift 4.1 doesn't specify version number #49518

Open
nicklockwood opened this issue Feb 9, 2018 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@nicklockwood
Copy link
Contributor

Previous ID SR-6970
Radar rdar://problem/37393816
Original Reporter @nicklockwood
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee @moiseev
Priority Medium

md5: e7313a190de8c10a8076466706410906

Issue Description:

The deprecation warning for flatMap() doesn't specify which version of Swift the change takes effect from:

@available(*, deprecated, renamed: "compactMap(_:)", message: "Please use compactMap(_:) for the case where closure returns an optional value")

This makes it impossible to write a polyfill for older Swift versions (such as the code below) without triggering the warning in Xcode 9.3:

#if !swift(>=4.1)
extension Array {
func compactMap<T>(_ transform: (Element) throws -> T?) rethrows -> [T] {
return try flatMap(transform)
}
}
#endif

@airspeedswift
Copy link
Member

@swift-ci create

@moiseev
Copy link
Mannequin

moiseev mannequin commented Feb 13, 2018

#14605

@moiseev
Copy link
Mannequin

moiseev mannequin commented Feb 14, 2018

For 4.1 branch: #14615

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants