Skip to content

Flow analysis. Unassigned variable is treated as definitely assigned #60503

@sgrekhov

Description

@sgrekhov
  int i;
  try {
    throw "throw!";
    i = 42;
  } finally {
    i; // Error: Non-nullable variable 'i' must be assigned before it can be used.
  }
  i; // No error

Why there is no error when i is read after try-finally block?

cc @stereotype441

Dart SDK version: 3.8.0-265.0.dev (dev) (Thu Apr 3 21:12:43 2025 -0700) on "windows_x64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-flowImplementation of flow analysis in analyzer/cfe

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions