From b9c65ddb7ae8fe2779853ef8cc21679d39efa88b Mon Sep 17 00:00:00 2001 From: NachoSoto Date: Mon, 3 Jun 2019 15:46:57 -0700 Subject: [PATCH 1/2] Signal: using Signal.Event.promoteValue This fixes compilation on `Xcode 11` / `Swift 5.1`. --- Sources/Event.swift | 26 ++++++++++++++++---------- Sources/Signal.swift | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Sources/Event.swift b/Sources/Event.swift index 578a604dc..f2886f53b 100644 --- a/Sources/Event.swift +++ b/Sources/Event.swift @@ -1015,17 +1015,23 @@ extension Signal.Event where Value == Never { internal static func promoteValue(_: U.Type) -> Transformation { 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() -> Signal.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 + } + } +} diff --git a/Sources/Signal.swift b/Sources/Signal.swift index 5f361d845..039bc9a83 100644 --- a/Sources/Signal.swift +++ b/Sources/Signal.swift @@ -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()) } } } } From a1f6c70715672f7e88a7d8c34aec12150ee1b90a Mon Sep 17 00:00:00 2001 From: Matt Diephouse Date: Tue, 4 Jun 2019 07:27:01 -0400 Subject: [PATCH 2/2] Fix indentation --- Sources/Event.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Event.swift b/Sources/Event.swift index f2886f53b..7c2495c52 100644 --- a/Sources/Event.swift +++ b/Sources/Event.swift @@ -1015,7 +1015,7 @@ extension Signal.Event where Value == Never { internal static func promoteValue(_: U.Type) -> Transformation { return { action, _ in return { event in - action(event.promoteValue()) + action(event.promoteValue()) } } }