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

Incorrect analyzer error on mixin application. #34896

Closed
leafpetersen opened this issue Oct 23, 2018 · 4 comments
Closed

Incorrect analyzer error on mixin application. #34896

leafpetersen opened this issue Oct 23, 2018 · 4 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@leafpetersen
Copy link
Member

class A<T> {
  void remove(T x) {}
}

class _B<T> = A<T> with B<T>;

mixin B<T> on A<T> {
  void remove(Object x) {
    super.remove(x as T);
  }
}

void main() {
}

The code above should be valid, but in both 2.1.0-dev.7.1 and bleeding edge the analyzer gives the following error:

leafp-macbookpro:sdk leafp$ ~/src/dart-repo/sdk/xcodebuild/ReleaseX64/dart-sdk/bin/dartanalyzer ~/tmp/ddctest.dart
Analyzing /Users/leafp/tmp/ddctest.dart...
  error • The super-invoked member 'remove' has the type '(Object) → void', but the concrete member in the class has type '(T) → void' at /Users/leafp/tmp/ddctest.dart:11:25 • mixin_application_concrete_super_invoked_member_type

It looks like the analyzer is requiring that the concrete remove method provided in the super class (A) has the signature of the remove method from B (Object -> void). This is incorrect. As specified, the concrete remove method provided by the super class must have a signature matching that in the superclass constraint from B (that is, the signature from A, i.e. T -> void).

This is causing a spurious error in converting charts_flutter. I'm looking for a workaround.

cc @keertip @lrhn @devoncarew

@leafpetersen leafpetersen added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Oct 23, 2018
@bwilkerson bwilkerson added P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Oct 23, 2018
@bwilkerson
Copy link
Member

@scheglov

@scheglov scheglov self-assigned this Oct 23, 2018
@scheglov
Copy link
Contributor

@leafpetersen
Copy link
Member Author

thanks!

@leafpetersen
Copy link
Member Author

FYI, I think I was able to work around the charts_flutter issue, so probably not blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants