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

Possible bug in diagnostics for mustBeConst #55573

Open
bwilkerson opened this issue Apr 26, 2024 · 2 comments
Open

Possible bug in diagnostics for mustBeConst #55573

bwilkerson opened this issue Apr 26, 2024 · 2 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-question A question about expected behavior or functionality

Comments

@bwilkerson
Copy link
Member

I would expect the following code to be valid, but it generated a diagnostic claiming that the argument to g isn't a constant expression, even though it is a constant expression:

import 'package:meta/meta.dart';

void f() {
  g(const C());
}

void g(@mustBeConst C c) {}

class C {
  const C();
}

Is that behavior intentional? Is it intended that only uses of const variables is allowed?

@bwilkerson bwilkerson added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-question A question about expected behavior or functionality labels Apr 26, 2024
@bwilkerson
Copy link
Member Author

@mosuem

@mosuem
Copy link
Member

mosuem commented May 2, 2024

I don't think that's intentional, let me check.

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. type-question A question about expected behavior or functionality
Projects
None yet
Development

No branches or pull requests

2 participants