Skip to content

[augmentations] No error when augmenting and introductory constructor both have redirection #59634

@sgrekhov

Description

@sgrekhov

Feature specification:

Redirecting generative constructors
...
It is a compile-time error if:

  • The augmented constructor has an initializer list or a body, or it has a redirection.

But the code below has no such error in the analyzer.

class C {
  int x;
  C(this.x);
  C.foo(int x);
}

augment class C {
  augment C.foo(int x) : this(x + 1); // Ok
  augment C.foo(int x) : this(x + 2); // Augmented constructor already has a redirection
//                       ^
// [analyzer] unspecified
// [cfe] unspecified
}

Appropriate co19 test

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.feature-augmentationsImplementation of the augmentations featuretype-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