Skip to content

Constant constructor in a class with a mixin #18653

Closed
@mkustermann

Description

@mkustermann

$ 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.

Metadata

Metadata

Assignees

Labels

devexp-commandIssues with the command-line dartanalyzer toollegacy-area-analyzerUse area-devexp instead.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions