Skip to content

Adds a convenience for mapping Never outputs to other types #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2025

Conversation

jszumski
Copy link
Contributor

@jszumski jszumski commented May 2, 2025

Adds a way to map a workflow's Never output type to a different type without generating compiler warnings. Fixes #339

@jszumski jszumski requested a review from a team as a code owner May 2, 2025 17:20
@CLAassistant
Copy link

CLAassistant commented May 2, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@jamieQ jamieQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! left some minor comments. also a test that this new method 'does the right thing' should be added, probably to AnyWorkflowTests.swift

@jszumski jszumski force-pushed the jszumski/fix-warnings-output-never branch from 12b344b to 3420d77 Compare May 2, 2025 19:08
@jszumski
Copy link
Contributor Author

jszumski commented May 2, 2025

Great feedback, I also added a simple test for it

@square-tomb
Copy link
Contributor

square-tomb commented May 2, 2025

This reminds me of ReactiveSwift's promoteError. I notice theirs takes the target type as an explicit parameter:

let (numbersSignal, numbersObserver) = Signal<Int, Never>.pipe()
let (lettersSignal, lettersObserver) = Signal<String, NSError>.pipe()

numbersSignal
    .promoteError(NSError.self)
    .combineLatest(with: lettersSignal)

I wonder if there are situations where that parameter is necessary for type inference to be succeed or be performant?

@jszumski jszumski force-pushed the jszumski/fix-warnings-output-never branch from 3420d77 to 8ed9bb3 Compare May 5, 2025 14:44
Copy link
Contributor

@jamieQ jamieQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm – thanks!

@jamieQ jamieQ merged commit 20d3025 into main May 5, 2025
6 checks passed
@jamieQ jamieQ deleted the jszumski/fix-warnings-output-never branch May 5, 2025 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a convenience for mapping outputs from Never to any type that does not produce compiler warnings
4 participants