Skip to content

Something is off with override checks in Kernel type checker #32917

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

Open
peter-ahe-google opened this issue Apr 18, 2018 · 0 comments
Open

Something is off with override checks in Kernel type checker #32917

peter-ahe-google opened this issue Apr 18, 2018 · 0 comments
Labels
front-end-kernel legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@peter-ahe-google
Copy link
Contributor

Consider this program:

abstract class A<Result, Input> {
  Result f(Input v);
}

abstract class A0<Result, Input> extends A<Result, Input> {}

abstract class M extends A<num, num> {
  @override
  num f(num v) => null;
}

void main() {}

If I create this as a test case in pkg/front_end/testcases/issue.dart and run:

./pkg/front_end/tool/fasta testing strong/issue -DupdateExpectations=true -DskipVm=true

The program type checks. If I then add a bad mixin application:

class Bad<U> = A0<dynamic, dynamic> with M;

I get this error:

In M::f at file:///Users/ahe/w/dart-sdk/sdk/pkg/front_end/testcases/issue.dart:9:

    Incompatible override of #lib1::A::f with #lib1::M::f:
    
        type of parameter v is incompatible
        override declares dart.core::num
        super method declares #lib1::A::Input

Kernel:
|
|   @dart.core::override
|

Source:
|
|     num f(num v) => null;
|

Two problems with this error:

  1. There's nothing wrong with the declaration of M.f. The error is actually on the mixin appliction.

  2. The super method doesn't declare v to have the type Input. Someone forgot to perform substitution of type parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front-end-kernel legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

2 participants