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

[stdlib] Removing the deprecated flatMap overload #9397

Merged
merged 1 commit into from
May 9, 2017

Conversation

moiseev
Copy link
Contributor

@moiseev moiseev commented May 8, 2017

The following code behaves incorrectly due to the presence of this
overload.

let a: Int = 1
let b: Int? = 2
let c: Int? = nil
let result: [Any] = [a, b, c].flatMap { $0 }

Fixes: rdar://problem/31910642

  • Explanation: A deprecated overload for flatMap behaves incorrectly in presence of Any type
  • Scope of Issue: The deprecated overload was added as a hint for developers that they might be using an inefficient call to flatMap instead of a more efficient map. It’s removal will fix the problem without breaking anything.
  • Risk: Minimal
  • Reviewed By: Ben Cohen
  • Testing: Automated test suite
  • Directions for QA: N/A
  • Radar: rdar://problem/32054458

The following code behaves incorrectly due to the presence of this
overload.

let a: Int = 1
let b: Int? = 2
let c: Int? = nil
let result: [Any] = [a, b, c].flatMap { $0 }

Fixes: <rdar://problem/31910642>
@moiseev
Copy link
Contributor Author

moiseev commented May 8, 2017

@swift-ci Please test

@moiseev
Copy link
Contributor Author

moiseev commented May 8, 2017

Similar to #7823

@airspeedswift airspeedswift merged commit d21be93 into apple:swift-4.0-branch May 9, 2017
@moiseev moiseev deleted the flatMap-4 branch May 9, 2017 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants