RESOLVED FIXED232656
[WebIDL] A default value = {} in a dictionary is not supported
https://bugs.webkit.org/show_bug.cgi?id=232656
Summary [WebIDL] A default value = {} in a dictionary is not supported
Myles C. Maxfield
Reported 2021-11-02 22:37:27 PDT
dictionary GPUDepthStencilState { GPUStencilFaceState stencilFront = {}; } The "= {}" is not supported.
Attachments
Patch (1.53 KB, patch)
2022-03-04 21:40 PST, Dan Glastonbury
no flags
Patch (9.61 KB, patch)
2022-03-08 18:18 PST, Dan Glastonbury
no flags
Patch (9.60 KB, patch)
2022-03-08 18:29 PST, Dan Glastonbury
sam: review+
ews-feeder: commit-queue-
Myles C. Maxfield
Comment 1 2021-11-03 01:10:21 PDT
Also the "= {}" in interface GPUCommandEncoder { GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {});
Radar WebKit Bug Importer
Comment 2 2021-11-09 21:38:20 PST
Sam Weinig
Comment 3 2022-03-03 10:28:13 PST
In most cases, we do the right thing if just remove the "= { }" because most interfaces treat `nullopt` and default constructed inner type the same. That said, this would certainly be nice to fix.
Dan Glastonbury
Comment 4 2022-03-03 22:07:31 PST
(In reply to Sam Weinig from comment #3) > In most cases, we do the right thing if just remove the "= { }" because most > interfaces treat `nullopt` and default constructed inner type the same. > > That said, this would certainly be nice to fix. I implemented this by adding the parsing for = {} and returning the "default" value as "{}". Do I need to update the generator if "we do the right thing..."? (I saw we handle $default == "[]")
Sam Weinig
Comment 5 2022-03-04 16:35:55 PST
If you just want to add the parsing now that is probably fine. I can add the code generator support at some point.
Dan Glastonbury
Comment 6 2022-03-04 21:32:13 PST
Ok, (In reply to Sam Weinig from comment #5) > If you just want to add the parsing now that is probably fine. I can add the > code generator support at some point. Thanks. I've added the parsing (which was pretty simple) and have the parse return undef so the = {} is effectively accepted and thrown away.
Dan Glastonbury
Comment 7 2022-03-04 21:40:44 PST
Sam Weinig
Comment 8 2022-03-08 17:05:37 PST
Comment on attachment 453901 [details] Patch Can you add a test?
Dan Glastonbury
Comment 9 2022-03-08 18:18:40 PST
Dan Glastonbury
Comment 10 2022-03-08 18:24:23 PST
Now with added testing.
Dan Glastonbury
Comment 11 2022-03-08 18:29:35 PST
Ahmad Saleem
Comment 12 2022-09-02 15:49:55 PDT
This r+ but I checked on Webkit Github that it has not landed and noticed that it failed some test cases. Is this required? Thanks!
Dan Glastonbury
Comment 13 2022-09-02 19:42:27 PDT
EWS
Comment 14 2022-09-03 16:46:12 PDT
Committed 254138@main (551709dd217f): <https://commits.webkit.org/254138@main> Reviewed commits have been landed. Closing PR #3982 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.