Skip to content

[6.0][stdlib] Undo the generalization of Result.map & .flatMap for now #72478

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
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
6 changes: 2 additions & 4 deletions stdlib/public/core/Result.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ extension Result {
/// - Returns: A `Result` instance with the result of evaluating `transform`
/// as the new success value if this instance represents a success.
@inlinable
@_preInverseGenerics
public func map<NewSuccess: ~Copyable>(
public func map<NewSuccess>(
_ transform: (Success) -> NewSuccess
) -> Result<NewSuccess, Failure> {
switch self {
Expand Down Expand Up @@ -175,8 +174,7 @@ extension Result {
/// - Returns: A `Result` instance, either from the closure or the previous
/// `.failure`.
@inlinable
@_preInverseGenerics
public func flatMap<NewSuccess: ~Copyable>(
public func flatMap<NewSuccess>(
_ transform: (Success) -> Result<NewSuccess, Failure>
) -> Result<NewSuccess, Failure> {
switch self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,8 @@ Func Optional.==(_:_:) has parameter 0 changing from Default to Shared
Func Optional.==(_:_:) has parameter 1 changing from Default to Shared
Func Optional.~=(_:_:) has generic signature change from <Wrapped> to <Wrapped where Wrapped : ~Copyable>
Func Optional.~=(_:_:) has parameter 1 changing from Default to Shared
Func Result.flatMap(_:) has generic signature change from <Success, Failure, NewSuccess where Failure : Swift.Error> to <Success, Failure, NewSuccess where Failure : Swift.Error, NewSuccess : ~Copyable>
Func Result.get() has generic signature change from <Success, Failure where Failure : Swift.Error> to <Success, Failure where Failure : Swift.Error, Success : ~Copyable>
Func Result.get() has self access kind changing from NonMutating to Consuming
Func Result.map(_:) has generic signature change from <Success, Failure, NewSuccess where Failure : Swift.Error> to <Success, Failure, NewSuccess where Failure : Swift.Error, NewSuccess : ~Copyable>
Func Result.mapError(_:) has self access kind changing from NonMutating to Consuming
Func UnsafeBufferPointer.deallocate() has generic signature change from <Element> to <Element where Element : ~Copyable>
Func UnsafeBufferPointer.distance(from:to:) has generic signature change from <Element> to <Element where Element : ~Copyable>
Expand Down
6 changes: 0 additions & 6 deletions test/api-digester/stability-stdlib-abi-without-asserts.test
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,7 @@ Func Optional.~=(_:_:) has generic signature change from <Wrapped> to <Wrapped w
Func Optional.~=(_:_:) has mangled name changing from 'static Swift.Optional.~= infix(Swift._OptionalNilComparisonType, Swift.Optional<A>) -> Swift.Bool' to 'static (extension in Swift):Swift.Optional< where A: ~Swift.Copyable>.~= infix(Swift._OptionalNilComparisonType, Swift.Optional<A>) -> Swift.Bool'
Func Optional.~=(_:_:) has parameter 1 changing from Default to Shared
Func Optional.~=(_:_:) is now with @_preInverseGenerics
Func Result.flatMap(_:) has generic signature change from <Success, Failure, NewSuccess where Failure : Swift.Error> to <Success, Failure, NewSuccess where Failure : Swift.Error, NewSuccess : ~Copyable>
Func Result.flatMap(_:) has mangled name changing from 'Swift.Result.flatMap<A>((A) -> Swift.Result<A1, B>) -> Swift.Result<A1, B>' to 'Swift.Result.flatMap<A where A1: ~Swift.Copyable>((A) -> Swift.Result<A1, B>) -> Swift.Result<A1, B>'
Func Result.flatMap(_:) is now with @_preInverseGenerics
Func Result.get() has been removed
Func Result.map(_:) has generic signature change from <Success, Failure, NewSuccess where Failure : Swift.Error> to <Success, Failure, NewSuccess where Failure : Swift.Error, NewSuccess : ~Copyable>
Func Result.map(_:) has mangled name changing from 'Swift.Result.map<A>((A) -> A1) -> Swift.Result<A1, B>' to 'Swift.Result.map<A where A1: ~Swift.Copyable>((A) -> A1) -> Swift.Result<A1, B>'
Func Result.map(_:) is now with @_preInverseGenerics
Func Result.mapError(_:) has been removed
Func UnsafeBufferPointer.deallocate() has generic signature change from <Element> to <Element where Element : ~Copyable>
Func UnsafeBufferPointer.deallocate() has mangled name changing from 'Swift.UnsafeBufferPointer.deallocate() -> ()' to '(extension in Swift):Swift.UnsafeBufferPointer< where A: ~Swift.Copyable>.deallocate() -> ()'
Expand Down