Go: a local or parameter used as a value references a same-named package function
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- go, typescript
- 領域
- compilers
調査の方向性
Start in src/extraction/tree-sitter.ts at flushFnRefCandidates, where Go function-value references are deduplicated per function and name. Reproduce with the apply(run) example, where a parameter shadows package-level func run, and check that use gets a references edge to function:run. Done means the shadowed use produces no edge to the package function, while a later unshadowed use in the same function still does. The issue leaves open whether to keep one ref per use or per scope, so agree that choice with the maintainers first.
索引モデルが issue の本文から書いたものです。
説明
Summary
In Go, using a local or parameter as a value, like apply(run) with a parameter run func(int, int) int, creates a references edge to a package-level func run that shares its name. The local shadows the package function there, so the edge is wrong. This is the value-use half of #2580; the PR for #2580 fixes bare calls only.
Reproduction (verified)
On main at c29caf2a, and on the #2580 branch, Linux, Node 22, CODEGRAPH_KERNEL=0:
package main
func run(a, b int) int { return a + b }
func apply(f any) {}
func use(run func(int, int) int) {
apply(run)
}
func main() { use(nil) }
codegraph init -i gives use -references-> function:run. A local gives the same: run := 1; _ = run.
Expected: no edge from use to the package run.
Why the #2580 fix doesn't cover it
Dropping a shadowed value ref is not safe as things stand. The extractor records a Go function-value ref once per function and name (flushFnRefCandidates, inferred from reading the code). If the first use in a function is a shadowing local and a later use is the package function, dropping the first ref also loses the later, correct one. A fix needs one ref per use, or a dedupe that keeps a ref per scope.
Related: #2580.
- 主要言語
- C
- スター
- 73.2k
- フォーク
- 4.7k
- 平均マージ
- 13時間 27分
- マージ済み PR(30日)
- 518
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
colbymchenry/codegraph のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
colbymchenry/codegraph#2634 ·
メンテナーはふだん 1 日以内に返信
-
Windows: bundled Node v24.16.0 can abort at exit (nodejs/node#56645); please bundle Node >= 24.20.0対応中かも @Ancienttwo が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
colbymchenry/codegraph#2617 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 72/100
colbymchenry/codegraph#2482 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
colbymchenry/codegraph#1900 · コメント 2 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
colbymchenry/codegraph#1700 ·
メンテナーはふだん 1 日以内に返信
colbymchenry/codegraph の issue をすべて見る
似ている issue
-
v9.6.0: CMake incorrectly enforces presence of libevdev対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
[Bug] Unhandled ValueError terminates watchdog thread when GISRC value contains multiple colonsオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
bug Component component: net
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
RT-Thread/rt-thread#11913 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
contiki-ng/contiki-ng#3289 ·
メンテナーはふだん 3 日以内に返信
-
area:docs help wanted type:enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信