Bug 265118 - NativePromise should allow void as reject type.
Summary: NativePromise should allow void as reject type.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-11-19 19:03 PST by Jean-Yves Avenard [:jya]
Modified: 2023-11-20 18:04 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2023-11-19 19:03:56 PST
NativePromise::Result is using `Expected<T, U>` as storage type ; which doesn't allow to have U==void

And as such, NativePromise must set a non-void type a RejectValueType.

In bug 264028, you can now chain promises of different types together, and if you chain a void promise, that promise gets resolve whenever the original promise gets resolved, regardless of the resolve value.

It would be nice to do the same for rejection. And as such, we need for NativePromise to handle RejectValueType == void.

This can be achieved by using Expected<T, NativePromise::VoidPlaceholder>
Comment 1 Jean-Yves Avenard [:jya] 2023-11-20 03:06:33 PST
<rdar://problem/117782213>
Comment 2 Jean-Yves Avenard [:jya] 2023-11-20 03:07:09 PST
Pull request: https://github.com/WebKit/WebKit/pull/20738
Comment 3 Jean-Yves Avenard [:jya] 2023-11-20 03:20:16 PST
rdar://118645560
Comment 4 EWS 2023-11-20 18:04:47 PST
Committed 270995@main (bb71e93437b5): <https://commits.webkit.org/270995@main>

Reviewed commits have been landed. Closing PR #20738 and removing active labels.