Skip to content

Flow analysis doesn't track definite unassignment in lazy locals correctly. #42990

Closed
@leafpetersen

Description

@leafpetersen

The following program does not read x in an unassigned state, but currently the front end and the analyzer report the use of x in the initializer of y as a definitely unassigned read. The laziness of late initializers does not seem to be taken into account in the flow analysis.

main() {
  late int x;
  late int y = x;

  x = 3;
  y;
}

cc @johnniwinther @scheglov @stereotype441

Metadata

Metadata

Assignees

Labels

NNBDIssues related to NNBD Releaselegacy-area-front-endLegacy: Use area-dart-model instead.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