Bug 262678 - NativePromise can't take callbacks defined with `auto`
Summary: NativePromise can't take callbacks defined with `auto`
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-10-04 22:49 PDT by Jean-Yves Avenard [:jya]
Modified: 2023-10-05 11:56 PDT (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-10-04 22:49:04 PDT
NativePromise template's to determine the type traits of the resolve/reject/settle methods are unable to deal with a lambda using `auto` for the type.

It causes a rather confusing, very long error message.

so you can't write something like:

using MyPromise = NativePromise<int, String>;
MyPromise::createAndSettle(workqueue, [] (auto&& result) {
});

you need to write:
MyPromise::createAndSettle(workqueue, [] (MyPromise::Result&& result) {
});

While it could be argued the latter is more readable and less prone to confusion, using `auto` everywhere is a rather popular trend within the WebKit team. So we should be able to deal with that if possible.
Comment 1 Radar WebKit Bug Importer 2023-10-04 22:49:22 PDT
<rdar://problem/116505009>
Comment 2 Jean-Yves Avenard [:jya] 2023-10-05 05:45:37 PDT
Pull request: https://github.com/WebKit/WebKit/pull/18690
Comment 3 EWS 2023-10-05 07:22:50 PDT
Committed 268913@main (93421fec4bd1): <https://commits.webkit.org/268913@main>

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