Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Fix the combination of setters and post-{increment/decrement} #319

Closed
litherum opened this issue Mar 8, 2019 · 1 comment
Closed

Fix the combination of setters and post-{increment/decrement} #319

litherum opened this issue Mar 8, 2019 · 1 comment

Comments

@litherum
Copy link
Contributor

litherum commented Mar 8, 2019

Migrated from https://bugs.webkit.org/show_bug.cgi?id=193550 on March 7, 2019

From @RobinMorisset:
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.

@RobinMorisset
Copy link
Collaborator

The JS implementation is now dead, so this issue is irrelevant.
We should just remember to add this test to the test suite.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants