Bug 193550 - [WHLSL] Fix the combination of setters and post-{increment/decrement}
Summary: [WHLSL] Fix the combination of setters and post-{increment/decrement}
Status: RESOLVED MOVED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-17 12:56 PST by Robin Morisset
Modified: 2019-03-07 18:28 PST (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 Robin Morisset 2019-01-17 12:56:02 PST
The reference implementation currently behaves really weirdly on post-incrementing a field of a struct with an overriden setter (and getter).
It correctly uses the getter for having the current value, increment it, uses the setter for updating it.. but somehow returns the new value instead of the old one.
I believe this is a bug in the reference implementation.

Example:
```
struct Foo {
  int z;
}
int operator.w(Foo foo) {
  return 8;
}
Foo operator.w=(Foo foo, int value) {
  foo.z = value;
return foo;
}
int bar() {
  Foo foo;
  foo.z = 3;
  int value = foo.w++;
  return value*100 + foo.z*10 + foo.w;
}
```
Calling bar() return 998 instead of 898 as I would expect.
Comment 1 Myles C. Maxfield 2019-03-07 18:28:35 PST
Migrated to https://github.com/gpuweb/WHLSL/issues/319