Skip to content

Dart analyzer not analyzing correct after If(variable case class) #56914

@abikko

Description

@abikko
  • Dart version and tooling diagnostic info (dart info)
    Screenshot 2024-10-18 at 14 05 18

  • Whether you are using Windows, macOS, or Linux - macOS

  • Whether you are using Chrome, Safari, Firefox, Edge - doesn't matter

Hello Dart team!

I have a problem, I searched the probably existing issues, but didn't find anything relating to this issue.

So, consider example, we have a sealed class with child classes like in screenshot below:
Screenshot 2024-10-18 at 14 12 57

And if we will write code like this:

Screenshot 2024-10-18 at 14 30 59

Dart analyzer will warn us that testor is A, not B after checking pattern.
Screenshot 2024-10-18 at 14 31 38

Metadata

Metadata

Assignees

No one assigned

    Labels

    legacy-area-analyzerUse area-devexp instead.triage-automationSee https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.type-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