Skip to content
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

DDC: Mixed in setter overrides of private fields are called unexpectedly during instantiation #36217

greglittlefield-wf opened this Issue Mar 14, 2019 · 0 comments


None yet
3 participants
Copy link

greglittlefield-wf commented Mar 14, 2019

In the DDC, when a mixin introduces a setter that overrides a private field, that setter is called unexpectedly during object initialization.

This seems to happen because the class is attempting to initialize the property backing that field to null, but ends up going through the setter instead unexpectedly.

This affects over_react, and we currently have a less-than-ideal workaround in place for this bug.

Reduced test case:

main() {
  // Prints "_privateVar setter called" unexpectedly.
  new C();

class A {
  var _privateVar;

mixin B on A {
  get _privateVar {
    print('_privateVar getter called');
  set _privateVar(value) {
    print('_privateVar setter called');

class C extends A with B {}

This happens with both the new and old mixin syntax.

This does not happen:

  • in dart2js
  • when the field is public
  • when the setter overrides occurs via a subclass

Reproducible in Dart SDK 2.2.0/2.2.1-dev.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.