Skip to content

consider new lint: use_logical_or #58861

Open
@pq

Description

@pq

We might consider a lint to encourage the use of a logical-or rather than the equivalent empty case logic.

BAD

switch (shape) {
  case Square():
  case Circle():
    print('Symmetric shape');
  default:
    print('Asymmetric shape');
}

GOOD

switch (shape) {
  case Square() | Circle():
    print('Symmetric shape');
  default:
    print('Asymmetric shape');
}

/cc @munificent @bwilkerson

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A 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.devexp-linterIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-new-language-featurelinter-status-pendingtype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions