graphify icon indicating copy to clipboard operation
graphify copied to clipboard

[Bug]: Dart: _bar() and bar() in one file share one node id, so one function vanishes

Open rohit-jsfreaky opened this issue 2 weeks ago • 2 comments

Pre-flight checks

  • [x] I have checked the Troubleshooting section in the README

What happened?

In Dart, two members whose names differ only by a leading _ (_bar() / bar()), or only by case, get one node id. One of them disappears from the graph, and its calls are credited to the other.

In Dart a leading _ means library-private, so _bar() next to bar() is very common.

This is the same bug fixed for Solidity in #5058 and Java in #5152; Python and C# already keep such twins apart (#3302, #4415).

The answer key is a separate tree-sitter scan that counts declarations per class/type.

repo colliding groups no node: v8 -> this PR nodes gained edges moved to the right function v8 ids changed
flutter/packages 51 51 -> 0 86 88 1 (doit/doIt, both public, so both salted)
riverpod 8 11 -> 7 4 6 0
dart-lang/http 10 10 -> 0 10 10 0

Steps to reproduce

// Foo.dart
class Foo {
  void bar() { ref.watch(helperProvider); }
  void _bar() { ref.watch(otherProvider); }
}

Run graphify update . and list the nodes and calls edges.

Error output or graph output

v8: one node, foo_bar; bar references both helperProvider and otherProvider.

Expected: foo_bar and foo_bar_2c4c06 (_bar), each referencing only its own provider.

Graphify version

0.9.108 (v8 at 52cb2821)

Operating System

Windows (also seen on Linux)

Python Version

3.12

Installation Method

uv tool install (recommended)

rohit-jsfreaky avatar Nov 13 '26 17:11 rohit-jsfreaky

Thanks for opening this issue, @rohit-jsfreaky. A maintainer will take a look soon.

If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

github-actions[bot] avatar Nov 13 '26 17:11 github-actions[bot]

Fixed by #5200 (e497cd46), released in graphify 0.9.109. Thanks @rohit-jsfreaky.

safishamsi avatar Nov 14 '26 22:11 safishamsi