Skip to content

"dead code" warning for short circuiting isn't complete #29196

Open
@MichaelRFairhurst

Description

@MichaelRFairhurst

In trivial cases its pretty easy to see what atually is/isn't dead code, in part because of the partial warning. But in more complicated cases, it may create confusion that the "dead code" section does not highlight all of the dead code (in mixtures of dead and live code, etc).

repro.dart:

main() {                                                                         
  return false && 1 == 2 && 3 == 4;                                              
}

What happens:

1 == 2 is highlighted as dead code because its after false && so won't do anything.

What I expect to happen:

1 == 2 && 3 == 4 is highlighted, because that entire section is dead, not just the 1 == 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-warningIssues with the analyzer's Warning codestype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions