Skip to content
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

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

Open
sgrekhov opened this issue Nov 29, 2024 · 0 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-augmentations Implementation of the augmentations feature

Comments

@sgrekhov
Copy link
Contributor

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

@sgrekhov sgrekhov added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-augmentations Implementation of the augmentations feature labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-augmentations Implementation of the augmentations feature
Projects
None yet
Development

No branches or pull requests

1 participant