[Bug]: Kotlin: _bar() and bar() (or case-only twins) share one node id, so one function vanishes
Pre-flight checks
- [x] I have checked the Troubleshooting section in the README
What happened?
In Kotlin, 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.
It is less common in Kotlin than in Dart or Swift (backing properties like _items are not extracted at all), but it does happen in real repos, mostly as case-only pairs and backtick test names.
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 | groups | no node: v8 -> this PR | calls fixed | v8 ids changed |
|---|---|---|---|---|
| ktor | 2 | 2 -> 0 | 12 | 2 |
| okhttp | 2 | 2 -> 0 | 4 | 2 |
| JetBrains/Exposed | 6 | 6 -> 0 | 34 | 0 |
| kotlinx.coroutines | 0 | 0 -> 0 | 0 | 0 |
kotlinx.serialization and moshi also have 0. 10 groups in about 34k methods across 6 repos.
Steps to reproduce
// Foo.kt
class Foo {
fun bar() { helper() }
private fun _bar() { other() }
fun caller() { _bar(); bar() }
}
Run graphify update . and list the nodes and calls edges.
Error output or graph output
v8: no ._bar() node; .bar() calls both helper and other.
Expected: ._bar() has its own node and every call lands on the right function.
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)
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.
Fixed by #5206 (7b6519c4), released in graphify 0.9.109. Thanks @rohit-jsfreaky.