Skip to content

Dart extension members are missing from the graph #1457

Closed

Description

@sgaabdu4

The Dart extractor does not descend into extension X on Y { } bodies. Every method declared inside an extension is absent from the graph.

Repro

One file, lib/a.dart:

class Holder {
  final int value;
  const Holder(this.value);
}

extension HolderMath on Holder {
  int doubled() => value + value;
  int tripled() => value + value + value;
  String describeHolder() => 'holder';
}

int topLevelHelper(int x) => x + 1;

Run index_repository, then search_graph for doubled, tripled, describeHolder, or HolderMath. Nothing matches. Holder, value, and topLevelHelper are all indexed.

Version

Reproduced on 0.8.1 and on 0.9.0. 0.9.0 emits one extra node for the same file, a Folder bookkeeping node, not the extension.

Impact

Dart codebases that use part of plus extensions to split a large class are almost entirely invisible. In our function, 24 of 57 files under lib/src are extension bodies, roughly 266 methods with no nodes. Tools built on top of the graph silently see an empty result instead of an error.

Workaround

search_code still finds these files because it greps raw content, so anything gated on graph coverage can fall back to the file key it returns.

Activity

  1. added
    bugSomething isn't working
    priority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
    on Sep 5, 2026
  2. DeusData commented on Sep 25, 2026

    @DeusData
    Owner

    Thank you so much @sgaabdu4 for this report. The minimal repro, the version check across 0.8.1 and 0.9.0, and the impact numbers made it quick to pin down.

    You were right: the Dart extractor didn't know extension_declaration was a container, so neither the extension nor anything inside it reached the graph. #2321 registers extensions as containers: extension HolderMath on Holder { ... } now shows up as a node with doubled, tripled and describeHolder as methods under it, and calls between them are attributed correctly. Members of unnamed extension on T { ... } blocks are indexed as file-level functions. On your repro the file goes from 4 to 9 nodes, so your 24 extension files under lib/src should show up after upgrading and re-indexing. Thanks again!

  3. added a commit that references this issue on Sep 30, 2026
  4. DeusData commented on Sep 30, 2026

    @DeusData
    Owner

    Thank you again for reporting this, @sgaabdu4! The fix is now on main in f5ecb5f (merged via #2321), and it will ship in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions