WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
Bug 199289
[WHLSL] 'uint y = x ? 1 : 2' fails to typecheck
https://bugs.webkit.org/show_bug.cgi?id=199289
Summary
[WHLSL] 'uint y = x ? 1 : 2' fails to typecheck
Myles C. Maxfield
Reported
2019-06-27 14:47:33 PDT
Right now we will unifyAndConmit both of the ResolvableTypes together, which IIRC will say “hey let’s just resolve these to their preferred type” which is int but the function needs to return uchar so fail!
Attachments
WIP
(26.38 KB, patch)
2019-07-03 19:21 PDT
,
Saam Barati
no flags
Details
Formatted Diff
Diff
WIP
(26.81 KB, patch)
2019-07-03 19:31 PDT
,
Saam Barati
no flags
Details
Formatted Diff
Diff
patch
(38.41 KB, patch)
2019-07-04 01:32 PDT
,
Saam Barati
no flags
Details
Formatted Diff
Diff
patch
(38.65 KB, patch)
2019-07-04 01:37 PDT
,
Saam Barati
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Saam Barati
Comment 1
2019-06-27 14:59:36 PDT
``` float foo() { return true ? 1 : 2 } ```
Myles C. Maxfield
Comment 2
2019-07-03 15:43:42 PDT
This patch should add the following text into the "operator cast" section of the standard library: operator uchar(bool x) { return x ? 1 : 0; } operator ushort(bool x) { return x ? 1 : 0; } operator uint(bool x) { return x ? 1 : 0; } operator char(bool x) { return x ? 1 : 0; } operator short(bool x) { return x ? 1 : 0; } operator half(bool x) { return x ? 1 : 0; } operator float(bool x) { return x ? 1 : 0; }
Saam Barati
Comment 3
2019-07-03 19:21:06 PDT
Created
attachment 373448
[details]
WIP Trying to fix some final bugs
Saam Barati
Comment 4
2019-07-03 19:31:22 PDT
Created
attachment 373449
[details]
WIP
Saam Barati
Comment 5
2019-07-04 01:32:39 PDT
Created
attachment 373457
[details]
patch
Saam Barati
Comment 6
2019-07-04 01:33:31 PDT
(In reply to Myles C. Maxfield from
comment #2
)
> This patch should add the following text into the "operator cast" section of > the standard library: > > operator uchar(bool x) { > return x ? 1 : 0; > } > operator ushort(bool x) { > return x ? 1 : 0; > } > operator uint(bool x) { > return x ? 1 : 0; > } > operator char(bool x) { > return x ? 1 : 0; > } > operator short(bool x) { > return x ? 1 : 0; > } > operator half(bool x) { > return x ? 1 : 0; > } > operator float(bool x) { > return x ? 1 : 0; > }
I need to rebase and do this, but the patch won't change. So it's still valuable to review in its current form.
Saam Barati
Comment 7
2019-07-04 01:37:09 PDT
Created
attachment 373458
[details]
patch
Robin Morisset
Comment 8
2019-07-05 18:12:00 PDT
Comment on
attachment 373458
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=373458&action=review
I don't currently understand this code well enough to give it an r+
> Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp:-368 > - }
Why change this?
> Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.cpp:63 > +static constexpr bool dumpASTAtEnd = true;
Please remove.
Saam Barati
Comment 9
2019-07-07 00:35:48 PDT
Comment on
attachment 373458
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=373458&action=review
>> Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp:-368 >> - } > > Why change this?
This is not intentional. Will revert
Myles C. Maxfield
Comment 10
2020-05-05 00:42:38 PDT
WHLSL is no longer relevant.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug