Skip to content
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
26 changes: 16 additions & 10 deletions Sources/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1015,17 +1015,23 @@ extension Signal.Event where Value == Never {
internal static func promoteValue<U>(_: U.Type) -> Transformation<U, Error> {
return { action, _ in
return { event in
switch event {
case .value:
fatalError("Never is impossible to construct")
case let .failed(error):
action(.failed(error))
case .completed:
action(.completed)
case .interrupted:
action(.interrupted)
}
action(event.promoteValue())
}
}
}
}

extension Signal.Event where Value == Never {
internal func promoteValue<U>() -> Signal<U, Error>.Event {
switch event {
case .value:
fatalError("Never is impossible to construct")
case let .failed(error):
return .failed(error)
case .completed:
return .completed
case .interrupted:
return .interrupted
}
}
}
2 changes: 1 addition & 1 deletion Sources/Signal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ extension Signal {
}

for (index, action) in builder.startHandlers.enumerated() where !lifetime.hasEnded {
lifetime += action(index, strategy) { observer.send($0.map { _ in fatalError() }) }
lifetime += action(index, strategy) { observer.send($0.promoteValue()) }
}
}
}
Expand Down