Skip to content

Commit ed15653

Browse files
committed
Fix merge damage by restoring the changes from @jamieQ
1 parent 1848fb2 commit ed15653

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Sources/AsyncAlgorithms/AsyncShareSequence.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sen
123123
final class Side {
124124
// Tracks the state of a single consumer's iteration.
125125
//
126-
// - `continuaton`: The continuation waiting for the next element (nil if not waiting)
126+
// - `continuation`: The continuation waiting for the next element (nil if not waiting)
127127
// - `position`: The consumer's current position in the shared buffer
128128
struct State {
129-
var continuaton: UnsafeContinuation<Result<Element?, Failure>, Never>?
129+
var continuation: UnsafeContinuation<Result<Element?, Failure>, Never>?
130130
var position = 0
131131

132132
// Creates a new state with the position adjusted by the given offset.
@@ -137,7 +137,7 @@ struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sen
137137
// - Parameter adjustment: The number of positions to subtract from the current position
138138
// - Returns: A new `State` with the adjusted position
139139
func offset(_ adjustment: Int) -> State {
140-
State(continuaton: continuaton, position: position - adjustment)
140+
State(continuation: continuation, position: position - adjustment)
141141
}
142142
}
143143

@@ -397,7 +397,7 @@ struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sen
397397
continuation.resume(returning: cancelled)
398398
}
399399
if let side {
400-
side.continuaton?.resume(returning: .success(nil))
400+
side.continuation?.resume(returning: .success(nil))
401401
}
402402
if let iteratingTaskToCancel {
403403
iteratingTaskToCancel.cancel()
@@ -437,7 +437,7 @@ struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sen
437437
await withUnsafeContinuation { (continuation: UnsafeContinuation<Void, Never>) in
438438
let hasPendingDemand = state.withLock { state in
439439
for (_, side) in state.sides {
440-
if side.continuaton != nil {
440+
if side.continuation != nil {
441441
return true
442442
}
443443
}
@@ -485,13 +485,13 @@ struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sen
485485
state.fail(failure)
486486
}
487487
for (id, side) in state.sides {
488-
if let continuation = side.continuaton {
488+
if let continuation = side.continuation {
489489
if side.position < state.buffer.count {
490490
resumptions.append(Resumption(continuation: continuation, result: .success(state.buffer[side.position])))
491491
state.sides[id]?.position += 1
492-
state.sides[id]?.continuaton = nil
492+
state.sides[id]?.continuation = nil
493493
} else if state.finished {
494-
state.sides[id]?.continuaton = nil
494+
state.sides[id]?.continuation = nil
495495
if let failure = state.failure {
496496
resumptions.append(Resumption(continuation: continuation, result: .failure(failure)))
497497
} else {
@@ -535,7 +535,7 @@ struct AsyncShareSequence<Base: AsyncSequence>: Sendable where Base.Element: Sen
535535
} else if state.finished {
536536
return state.emit(.success(nil), limit: limit)
537537
} else {
538-
state.sides[id]?.continuaton = continuation
538+
state.sides[id]?.continuation = continuation
539539
return state.emit(nil, limit: limit)
540540
}
541541
}

0 commit comments

Comments
 (0)