Bug 262678

Summary: NativePromise can't take callbacks defined with `auto`
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: Web Template FrameworkAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=262713

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.