Skip to content

Spurious 'constant constructor can't call a non-constant superconstructor' error #40982

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

Closed
eernstg opened this issue Mar 11, 2020 · 7 comments
Closed
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@eernstg
Copy link
Member

eernstg commented Mar 11, 2020

Cf. #32223 (comment), the front end seems to get confused about constructors during mixin application if there is a static variable declaration in a mixin:

class A {
  const A();
}

mixin B {
  static const int value=1; // This causes the error, with and without `const`.
  void printStuff() => print('Hello from B!');
}

class C extends A with B {
  const C();
}

The response with a fresh front end (commit 5ae4448) is as follows:

n002.dart:14:9: Error: A constant constructor can't call a non-constant super constructor.
  const C();
        ^
@eernstg eernstg added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) legacy-area-front-end Legacy: Use area-dart-model instead. labels Mar 11, 2020
@scheglov
Copy link
Contributor

BTW, @srawlins fixed this in analyzer in 9f6c372.

@srawlins
Copy link
Member

Ah ha, so I did!

@scheglov
Copy link
Contributor

Hm... This issue is for CFE, but it references another issue that says that analyzer reports an error. So, I just provided some context. But I think we should leave this CFE issue open.

@scheglov scheglov reopened this Jun 12, 2020
@srawlins
Copy link
Member

Oops; thanks

@artob
Copy link

artob commented Aug 19, 2020

Running into this with my Flutter plugin, on the beta channel. Is this fixed on any Flutter release channel as yet?

@Miiite
Copy link

Miiite commented Nov 5, 2020

I just encountered this, on the stable channel (v1.22.2)

@marcglasberg
Copy link

I am also having this problem.

@johnniwinther johnniwinther added the P2 A bug or feature request we're likely to work on label Nov 12, 2020
@johnniwinther johnniwinther self-assigned this Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants