Skip to content

Flow analysis not accepting uninitialized final variables that are definitely assigned exactly once #38237

@stereotype441

Description

@stereotype441

From an IM conversation with @Hixie

The following code should be accepted with NNBD enabled (@leafpetersen confirmed):

final int foo;
switch (bar) {
  case 'a': foo = 1; break;
  case 'b': foo = 2; break;
  default: foo = 3;
}

It is currently rejected by the analyzer. We need to get this working and make sure there is a language_2 test case for it (so that we won't forget to ensure that it works on CFE as well).

Metadata

Metadata

Assignees

Labels

NNBDIssues related to NNBD Releasedart-model-analyzer-specIssues with the analyzer's implementation of the language speclegacy-area-analyzerUse area-devexp instead.needs-infoWe need additional information from the issue author (auto-closed after 14 days if no response)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions