-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-false-negativeIssues related to lint rules that fail to report a problem.Issues related to lint rules that fail to report a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
When doing this:
final email = (user.email != null) ? (user.email!) : '';This is a dumb example, but my point is that in other ternary expressions that I've used, I saw this.
I think that the (user.email!) expression should trigger this as well. I'm not sure because this might be intentional to leave ternary expressions with possible parentheses around all possible results and the test, but it seems strange to me that it doesn't warn me when that is not strictly necessary.
This is a false negative that occurs in any of the three places of a ternary operator.
_Originally posted by @FMorschel in #57137
Edit: here is the CL: https://dart-review.googlesource.com/c/sdk/+/390161
Edit 2: Linking the related issue: #59069
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-false-negativeIssues related to lint rules that fail to report a problem.Issues related to lint rules that fail to report a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)