RESOLVED FIXED 199634
[WHLSL] Make enums work
https://bugs.webkit.org/show_bug.cgi?id=199634
Summary [WHLSL] Make enums work
Saam Barati
Reported 2019-07-09 12:21:24 PDT
This shouldn't crash: enum Weekday { Monday, Tuesday, Wednesday, Thursday, Pizzaday } int foo() { (Weekday.Monday); return 42; }
Attachments
WIP (36.66 KB, patch)
2019-07-15 17:36 PDT, Saam Barati
no flags
patch (42.53 KB, patch)
2019-07-17 04:22 PDT, Saam Barati
no flags
patch (42.45 KB, patch)
2019-07-17 04:29 PDT, Saam Barati
rmorisset: review+
Saam Barati
Comment 1 2019-07-15 17:14:36 PDT
doing this
Saam Barati
Comment 2 2019-07-15 17:36:23 PDT
Created attachment 374172 [details] WIP WIP. It's starting to work. Just need to write some interesting tests around "overflowing" the +1 of enum values past UINT_MAX/INT_MAX
Saam Barati
Comment 3 2019-07-17 04:22:44 PDT
Saam Barati
Comment 4 2019-07-17 04:29:27 PDT
Robin Morisset
Comment 5 2019-07-17 11:24:00 PDT
Comment on attachment 374288 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=374288&action=review r=me with just a few comments. > Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp:852 > +auto Parser::parseEnumerationMember(int64_t defaltValue) -> Expected<AST::EnumerationMember, Error> defalt -> default > Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp:875 > + return AST::EnumerationMember(*identifier, WTFMove(name), defaltValue); defalt -> default > LayoutTests/webgpu/whlsl-enums-2.html:64 > + return a == b; So == and != are to be automatically generated for enums? I can add it to the spec if it is on purpose. > LayoutTests/webgpu/whlsl-enums-2.html:144 > + return _war().value; Similarly, this ".value" thing is not in the spec currently. I can add it, but why have both this and int(_war()) be supported? > LayoutTests/webgpu/whlsl-enums.html:13 > +whlslTests.failTrickyDoubleZero = async () => { The tests in this file are very nice! 👍
Saam Barati
Comment 6 2019-07-20 05:09:22 PDT
Comment on attachment 374288 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=374288&action=review >> LayoutTests/webgpu/whlsl-enums-2.html:144 >> + return _war().value; > > Similarly, this ".value" thing is not in the spec currently. I can add it, but why have both this and int(_war()) be supported? I just copied this from the spec repo. I vote for removing it unless we think it's necessary. I'll omit these tests for now.
Saam Barati
Comment 7 2019-07-20 05:10:29 PDT
Comment on attachment 374288 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=374288&action=review >> LayoutTests/webgpu/whlsl-enums-2.html:64 >> + return a == b; > > So == and != are to be automatically generated for enums? I can add it to the spec if it is on purpose. Yeah I believe they are.
Saam Barati
Comment 8 2019-07-20 05:41:57 PDT
Radar WebKit Bug Importer
Comment 9 2019-07-20 05:42:33 PDT
Note You need to log in before you can comment on or make changes to this bug.