-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overriding an abstract getter with a final field generates incorrect code #280
Milestone
Comments
I'm seeing similar problems when the getter is not abstract: class A { class B extends A { Setting the value x in the derived class is not working for me. |
Added this to the FrogEditor milestone. |
as of r1908, both of these examples are working correctly. Added Fixed label. |
nex3
pushed a commit
that referenced
this issue
Aug 31, 2016
this also implements multitest support, which fixes #280 Fixes some other preexisting bugs: * MetaLets did not simplify themselves correctly in some nested cases * Library prefixed identifiers did not work as lvalues in opassign * dsetindex/dput/[]= methods did not return a value * checker did not correctly handle invalid constructor field initializers * cascades did not correctly work with method invocations(?) * postfix ++/-- did not correctly generate lvalues in some cases The good news: because this reuses on our existing lvalue/metalet helpers, it managed to flush out a lot of bugs in other features that use them. [email protected] Review URL: https://codereview.chromium.org/1316723003 .
This was referenced Oct 29, 2020
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We're using this pattern in the compiler:
class VarMember {
abstract String get name();
...
}
class VarFunctionStub extends VarMember {
final String name;
...
}
The code generated for this is incorrect. It tries to create a "name" property on VarMember, which looks like:
Object.defineProperty(VarMember.prototype, "name", {
get: VarMember.prototype.get$name,
});
Except get$name doesn't exist on the base class. Also, this prevents the setters on the derived classes from working (e.g. "this.name = name;" in VarFunctionStub ctor).
At this point you might be wondering: why isn't the self-hosted compiler currently broken? It is not broken! Probably because we don't use ".name" dynamically. This bug is only triggered when the compiler is used in the same codebase as DOM (or html?) libraries.
The text was updated successfully, but these errors were encountered: