Skip to content

Constant forwarding constructors could be supported #27061

Closed

Description

@johnniwinther

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.

Activity

  1. added
    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).
    type-enhancementA request for a change that isn't a bug
    on Aug 12, 2016
  2. lrhn commented on Aug 12, 2016

    @lrhn
    Member

    Duplicate of #9745

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reporttype-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions