dart-lang / dart-lang/language

Flow analysis - keep non-nullability on join

Open
#1,377 4 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature flow-analysis nnbd request
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

Here ancestor has initially type Element?, so cannot be promoted to either ClassElement or ExtensionElement.
But it cannot be null if any of them is true.

    var ancestor = enclosingElement;
    if (ancestor is ClassElement || ancestor is ExtensionElement) {
      if (ancestor.hasDoNotStore) {
        return true;
      }
    }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the flow-analysis example in the issue and review the language specification's rules for type promotion across a join. Done means the stated non-nullability is preserved when either type test succeeds, with the behavior documented and covered by the relevant specification examples or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.