Skip to content

Conversation

@srawlins
Copy link
Member

These "mixed-in field" tests are a little complex, involving four types and a diamond-shaped inheritance graph. But they are meaningful; sort of the smallest diamond-shape of inheritance. I struggled to make sense of the end-to-end tests (as a change I was making was breaking them) and just had to convert them to unit tests to make them make sense 😅 .

Copy link
Contributor

@szakarias szakarias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

equals(GenericMixin));
expect(overrideByBoth.canonicalEnclosingContainer, equals(GenericMixin));
expect(overrideByModifierClass.canonicalEnclosingContainer,
equals(ModifierClass));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how important this is, but are we maybe missing this test case in the new (and much nicer) setup?

If I understand it correctly we are testing that a field in a subclass identifies the correct enclosing container even though there is a mixin (that does not override the field)? Something like:

    class C {
      int x = 0;
    }
    class D extends C {
      @override
      int x = 1;
    }
    mixin M on C {
      // M does not override x
    }
    class E extends D with M {}
    ```

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you're right... I replaced each test one-by-one, I should have covered everything, but yes it looks like I'm missing this case. I think I am getting a cold; maybe my brain is foggy 😅 .

@srawlins srawlins merged commit 9389132 into dart-lang:main Jan 30, 2026
14 checks passed
@srawlins srawlins deleted the mixed-in-tests branch January 30, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants