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

Questions on null_check_on_nullable_type_parameter #58666

Open
srawlins opened this issue Feb 27, 2022 · 2 comments
Open

Questions on null_check_on_nullable_type_parameter #58666

srawlins opened this issue Feb 27, 2022 · 2 comments
Labels
area-devexp Developer experience items (DevTools, IDEs, analysis server, completions, refactorings, ...). devexp-linter Issues with the analyzer's support for the linter package linter-false-negative linter-set-core P2 A bug or feature request we're likely to work on type-question A question about expected behavior or functionality

Comments

@srawlins
Copy link
Member

I was looking at test cases in order to implement a quick fix for null_check_on_nullable_type_parameter but came across some test cases that surprised me.

Future<T> / await p!:

Future<T> m40<T extends Object?>(T? p) async => await p!; // LINT

This case does not generate a lint report, but I expected it would.

List<T> / [p!]:

void ff<T>(T? p) {
  <T>[p!]; // LINT
}

This case also does not generate a lint report, but I expected it would.

Stream<T> / yield p!:

Stream<T> m41<T extends Object?>(T? p) async* { yield p!; }

This case also does not generate a lint report, but I expected it would.

@srawlins srawlins added the type-question A question about expected behavior or functionality label Feb 27, 2022
@srawlins
Copy link
Member Author

CC @leafpetersen who filed the initial lint rule request

CC @a14n who implemented the lint rule

CC @goderbauer in case this affects the decision to add this to lints/recommended.yaml as per dart-lang/core#764

@a14n
Copy link
Contributor

a14n commented Feb 28, 2022

This case also does not generate a lint report, but I expected it would.

I expected the same. Those cases were just forgotten during the implementation. I guess the following method should be extended to cover those cases. https://github.com/dart-lang/linter/blob/8c01f686b0d17233c49f8d7b86fe1b984d64086c/lib/src/rules/unnecessary_null_checks.dart#L39-L83.

@srawlins srawlins added P2 A bug or feature request we're likely to work on linter-false-negative and removed type-question A question about expected behavior or functionality labels Oct 26, 2022
@srawlins srawlins added the type-question A question about expected behavior or functionality label Mar 29, 2024
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 19, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 19, 2024
@bwilkerson bwilkerson added area-devexp Developer experience items (DevTools, IDEs, analysis server, completions, refactorings, ...). and removed area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp Developer experience items (DevTools, IDEs, analysis server, completions, refactorings, ...). devexp-linter Issues with the analyzer's support for the linter package linter-false-negative linter-set-core P2 A bug or feature request we're likely to work on type-question A question about expected behavior or functionality
Projects
None yet
Development

No branches or pull requests

5 participants