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

Annotation required parameters are ignored #48969

Closed
Ehesp opened this issue May 6, 2022 · 3 comments
Closed

Annotation required parameters are ignored #48969

Ehesp opened this issue May 6, 2022 · 3 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on

Comments

@Ehesp
Copy link

Ehesp commented May 6, 2022

This bug appears on both:

  • Dart SDK version: 2.16.2 (stable)
  • Dart 2.18.0 (build 2.18.0-91.0.dev)

Given the following code snippet:

class MyAnnotation {
  final String foo;

  const MyAnnotation({
    required this.foo,
  });
}

@MyAnnotation()
class MyClass {}

void main() {
  MyAnnotation();
}

The analyzer does not complain that the required foo parameter is missing when used as an annotation. However, it does when the class is instantiated (within main). I am able to omit the required values from the annotation when they should be required.

@bwilkerson bwilkerson added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on labels May 6, 2022
@bwilkerson
Copy link
Member

@scheglov

@scheglov scheglov self-assigned this May 6, 2022
@scheglov
Copy link
Contributor

scheglov commented May 6, 2022

https://dart-review.googlesource.com/c/sdk/+/243925

copybara-service bot pushed a commit that referenced this issue May 6, 2022
Bug: #48969
Change-Id: I8fd8a13fc7174d936d27062e2d41787f241b2b07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243925
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
@scheglov scheglov closed this as completed May 7, 2022
@Ehesp
Copy link
Author

Ehesp commented May 7, 2022

Dang thanks for the quick action!

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. P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

3 participants