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 doNotSubmit #55558

Open
bwilkerson opened this issue Apr 24, 2024 · 8 comments
Open

Possible bug in diagnostics for doNotSubmit #55558

bwilkerson opened this issue Apr 24, 2024 · 8 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 type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@bwilkerson
Copy link
Member

I expected to have a diagnostic produced by the following code, but there is none.

import 'package:meta/meta.dart';

@doNotSubmit
void a() {}

void b() => a();

Should there be one?

@bwilkerson bwilkerson added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Apr 24, 2024
@bwilkerson
Copy link
Member Author

@matanlurey

@matanlurey
Copy link
Contributor

Not necessarily a bug but then definitely documentation that's missing; inevitably code marked doNotSubmit might need to get accessed from somewhere, so we don't check for violations in the same library.

I know there is similar permissiveness in other annotations, so if that seems fine I'll send a patch to update the docs.

It also wouldn't be a huge change to enforce same library violations at this point.

@matanlurey
Copy link
Contributor

@srawlins thoughts?

@srawlins
Copy link
Member

I like the sentiment that doNotSubmit might need to be used locally. This is similar to how we don't report usage of a @deprecated element from within another @deprecated element.

But that exact shape might not be helpful here. Do you know, specifically for solo in package:test, @matanlurey ?

@matanlurey
Copy link
Contributor

I think that, for say:

void test({@doNotSubmit bool solo = false}) {
  if (solo) { ... }
}

... this should work out of the box (and does today). The question is if this should be flagged:

void test({@doNotSubmit bool solo = false}) {}

// Same library.
void megaTest() {
  test(solo: true);
}

@bwilkerson
Copy link
Member Author

What is the use case for allowing it to be executed outside of another function that's also marked as @doNotSubmit?

If there isn't one, it might be better to be more restrictive in v1 and to relax it when we have a use case. Making a check like this more restrictive can be a huge breaking change, and sometimes impossible.

@matanlurey
Copy link
Contributor

I'm fine with that. Let me take this bug to increase the restrictive nature of the annotation.

@matanlurey matanlurey self-assigned this Apr 24, 2024
@pq pq added the P2 A bug or feature request we're likely to work on label Apr 24, 2024
@matanlurey
Copy link
Contributor

@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Apr 26, 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. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants