Skip to content

Commit a25a383

Browse files
committed
Remove generalization of the result for Sequence.reduce
1 parent 97d9339 commit a25a383

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

stdlib/public/core/SequenceAlgorithms.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,9 @@ extension Sequence {
665665
///
666666
/// - Complexity: O(*n*), where *n* is the length of the sequence.
667667
@_alwaysEmitIntoClient
668-
public func reduce<Result: ~Copyable, E: Error>(
669-
_ initialResult: consuming Result,
670-
_ nextPartialResult: (borrowing Result, Element) throws(E) -> Result
668+
public func reduce<Result, E: Error>(
669+
_ initialResult: Result,
670+
_ nextPartialResult: (Result, Element) throws(E) -> Result
671671
) throws(E) -> Result {
672672
var accumulator = initialResult
673673
for element in self {
@@ -721,8 +721,8 @@ extension Sequence {
721721
///
722722
/// - Complexity: O(*n*), where *n* is the length of the sequence.
723723
@_alwaysEmitIntoClient
724-
public func reduce<Result: ~Copyable, E: Error>(
725-
into initialResult: consuming Result,
724+
public func reduce<Result, E: Error>(
725+
into initialResult: __owned Result,
726726
_ updateAccumulatingResult: (inout Result, Element) throws(E) -> ()
727727
) throws(E) -> Result {
728728
var accumulator = initialResult

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,10 @@ Func Sequence.forEach(_:) has generic signature change from <Self where Self : S
393393
Func Sequence.forEach(_:) is now without @rethrows
394394

395395
// Adoption of typed throws for Sequence.reduce(_:_:)
396-
Func Sequence.reduce(_:_:) has generic signature change from <Self, Result where Self : Swift.Sequence> to <Self, Result, E where Self : Swift.Sequence, E : Swift.Error, Result : ~Copyable>
397-
Func Sequence.reduce(_:_:) has parameter 0 changing from Default to Owned
396+
Func Sequence.reduce(_:_:) has generic signature change from <Self, Result where Self : Swift.Sequence> to <Self, Result, E where Self : Swift.Sequence, E : Swift.Error>
398397
Func Sequence.reduce(_:_:) is now without @rethrows
399398

400399
// Adoption of typed throws for Sequence.reduce(into:_:)
401-
Func Sequence.reduce(into:_:) has generic signature change from <Self, Result where Self : Swift.Sequence> to <Self, Result, E where Self : Swift.Sequence, E : Swift.Error, Result : ~Copyable>
400+
Func Sequence.reduce(into:_:) has generic signature change from <Self, Result where Self : Swift.Sequence> to <Self, Result, E where Self : Swift.Sequence, E : Swift.Error>
402401
Func Sequence.reduce(into:_:) has parameter 1 type change from (inout Result, Self.Element) throws -> () to (inout Result, Self.Element) throws(E) -> ()
403402
Func Sequence.reduce(into:_:) is now without @rethrows

0 commit comments

Comments
 (0)