Skip to content

Analyzer does not allow mixins to be derived from classes with super-invocations. #34806

@lrhn

Description

@lrhn

The Dart 2 specification rolled back the ability to derive a mixin from a class with a superclass other than Object It did not reintroduce the rule that made it an error to derive a mixin from a class with a super-invocation.

The analyzer rejects mixins derived from classes with super-invocations.
Since those super-invocations are necessarily on members of Object, there is no need to disallow them.

The front-end does allow super-invocations in mixins derived from objects, for example:

class C {
  toString() => "[${super.toString()}]";
}
class D {
  toString() => "Yep!";
}
class E = D with C;
main() {
  print(E());  // "[Yep!]"
}

This runs in the VM and dart2js, and should be accepted by the analyzer too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    legacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions