Skip to content

Constant forwarding constructors could be supported #27061

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
johnniwinther opened this issue Aug 12, 2016 · 1 comment
Closed

Constant forwarding constructors could be supported #27061

johnniwinther opened this issue Aug 12, 2016 · 1 comment
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug

Comments

@johnniwinther
Copy link
Member

Currently constant forwarding constructors are not supported, which seems like an oversight.

For instance:

class S {
  final a, b;
  const S({this.a, this.b});
}
class M {}
class C extends S with M {
  const C() : super(b: 2, a: 1);
}
main() => const C();

const C() is not allowed since the super constructor (S+M) is not constant. This could be supported if the constness of the S constructor propagated to the forwarding S+M constructor where feasible.

@johnniwinther johnniwinther added area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). type-enhancement A request for a change that isn't a bug labels Aug 12, 2016
@lrhn lrhn added the closed-duplicate Closed in favor of an existing report label Aug 12, 2016
@lrhn
Copy link
Member

lrhn commented Aug 12, 2016

Duplicate of #9745

@lrhn lrhn closed this as completed Aug 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants