Skip to content

Constant constructor in a class with a mixin #18653

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
mkustermann opened this issue May 6, 2014 · 9 comments
Closed

Constant constructor in a class with a mixin #18653

mkustermann opened this issue May 6, 2014 · 9 comments
Assignees
Labels
devexp-command Issues with the command-line dartanalyzer tool legacy-area-analyzer Use area-devexp instead.
Milestone

Comments

@mkustermann
Copy link
Member

$ cat test.dart
class A {
  const A();
}

class MyMixin {}

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

main() {
  var b = const B();
}

$ dartanalyzer test.dart
Analyzing test.dart...
No issues found

$ dart test.dart
'file:///usr/local/google/home/kustermann/appengine/dart-app-engine/datastore-python-compatibility/test.dart': error: line 9 pos 12: implicit call to non-const super constructor
  const B();
           ^

$ dart2js test.dart --out=/tmp/foo.js
test.dart:9:3:
Error: 'const' constructor cannot call a non-const constructor.
  const B();
  ^^^^^^^^^^
Error: Compilation failed.

@kasperl
Copy link

kasperl commented May 6, 2014

This is related to issue #9745.

1 similar comment
@kasperl
Copy link

kasperl commented May 6, 2014

This is related to issue #9745.

@peter-ahe-google
Copy link
Contributor

This may be related to issue #9745, but the analyzer is wrong. MyMixin doesn't have a const constructor, so even after fixing issue #9745, this particular test should fail.

@lrhn
Copy link
Member

lrhn commented May 6, 2014

Actually, if issue #9745 was fixed as requested, the forwarding constructor would be const, and this code would work.
That fix won't happen, so the analyzer is definitely wrong - the superclass of B (A with Mixin) has no const constructor.

@bwilkerson
Copy link
Member

Added this to the 1.5 milestone.
Removed Priority-Unassigned label.
Added Priority-Medium, Area-Analyzer labels.

@scheglov
Copy link
Contributor

scheglov commented May 8, 2014

Set owner to @scheglov.
Added Accepted label.

@scheglov
Copy link
Contributor

scheglov commented May 8, 2014

https://codereview.chromium.org/272803002


Added Started label.
Changed the title to: "Constant constructor in a class with a mixin".

@scheglov
Copy link
Contributor

scheglov commented May 8, 2014

@clayberg
Copy link

clayberg commented May 8, 2014

Removed this from the 1.5 milestone.
Added this to the 1.4 milestone.

@mkustermann mkustermann added Type-Defect legacy-area-analyzer Use area-devexp instead. devexp-command Issues with the command-line dartanalyzer tool labels May 8, 2014
@mkustermann mkustermann added this to the 1.4 milestone May 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-command Issues with the command-line dartanalyzer tool legacy-area-analyzer Use area-devexp instead.
Projects
None yet
Development

No branches or pull requests

7 participants