Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Constant constructor in a class with a mixin #18653

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
analyzer-command Issues with the command-line dartanalyzer tool area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
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 area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-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.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
analyzer-command Issues with the command-line dartanalyzer tool area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

7 participants