Skip to content

Analyzer doesn't handle constant forwarding constructors #41072

@johnniwinther

Description

@johnniwinther

In this code the forwarding constructor in Application is constant (because the corresponding constructor in Base is constant) but analyzer reports that "The constructor being called isn't a const constructor."

import "package:expect/expect.dart";

abstract class Mixin {}
class Base {
  final int x;
  const Base(this.x);
}
class Application = Base with Mixin;
main() {
  Expect.equals(42, const Application(42).x); // Error reported here.
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions