Skip to content

Commit 5afa19c

Browse files
authored
Merge pull request #72478 from lorentey/undo-Result.map&.flatMap-generalization-6.0
[6.0][stdlib] Undo the generalization of `Result.map` & `.flatMap` for now
2 parents e78e36f + 0ee41bd commit 5afa19c

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

stdlib/public/core/Result.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ extension Result {
4949
/// - Returns: A `Result` instance with the result of evaluating `transform`
5050
/// as the new success value if this instance represents a success.
5151
@inlinable
52-
@_preInverseGenerics
53-
public func map<NewSuccess: ~Copyable>(
52+
public func map<NewSuccess>(
5453
_ transform: (Success) -> NewSuccess
5554
) -> Result<NewSuccess, Failure> {
5655
switch self {
@@ -175,8 +174,7 @@ extension Result {
175174
/// - Returns: A `Result` instance, either from the closure or the previous
176175
/// `.failure`.
177176
@inlinable
178-
@_preInverseGenerics
179-
public func flatMap<NewSuccess: ~Copyable>(
177+
public func flatMap<NewSuccess>(
180178
_ transform: (Success) -> Result<NewSuccess, Failure>
181179
) -> Result<NewSuccess, Failure> {
182180
switch self {

test/api-digester/Outputs/stability-stdlib-source-x86_64.swift.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,8 @@ Func Optional.==(_:_:) has parameter 0 changing from Default to Shared
253253
Func Optional.==(_:_:) has parameter 1 changing from Default to Shared
254254
Func Optional.~=(_:_:) has generic signature change from <Wrapped> to <Wrapped where Wrapped : ~Copyable>
255255
Func Optional.~=(_:_:) has parameter 1 changing from Default to Shared
256-
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>
257256
Func Result.get() has generic signature change from <Success, Failure where Failure : Swift.Error> to <Success, Failure where Failure : Swift.Error, Success : ~Copyable>
258257
Func Result.get() has self access kind changing from NonMutating to Consuming
259-
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>
260258
Func Result.mapError(_:) has self access kind changing from NonMutating to Consuming
261259
Func UnsafeBufferPointer.deallocate() has generic signature change from <Element> to <Element where Element : ~Copyable>
262260
Func UnsafeBufferPointer.distance(from:to:) has generic signature change from <Element> to <Element where Element : ~Copyable>

test/api-digester/stability-stdlib-abi-without-asserts.test

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,7 @@ Func Optional.~=(_:_:) has generic signature change from <Wrapped> to <Wrapped w
605605
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'
606606
Func Optional.~=(_:_:) has parameter 1 changing from Default to Shared
607607
Func Optional.~=(_:_:) is now with @_preInverseGenerics
608-
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>
609-
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>'
610-
Func Result.flatMap(_:) is now with @_preInverseGenerics
611608
Func Result.get() has been removed
612-
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>
613-
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>'
614-
Func Result.map(_:) is now with @_preInverseGenerics
615609
Func Result.mapError(_:) has been removed
616610
Func UnsafeBufferPointer.deallocate() has generic signature change from <Element> to <Element where Element : ~Copyable>
617611
Func UnsafeBufferPointer.deallocate() has mangled name changing from 'Swift.UnsafeBufferPointer.deallocate() -> ()' to '(extension in Swift):Swift.UnsafeBufferPointer< where A: ~Swift.Copyable>.deallocate() -> ()'

0 commit comments

Comments
 (0)