Go: a local or parameter used as a value references a same-named package function
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- go, typescript
- Área
- compilers
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C
- Estrellas
- 73.2k
- Forks
- 4.7k
- Merge medio
- 2 h 16 min
- PR fusionados (30 d)
- 423
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de colbymchenry/codegraph
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
colbymchenry/codegraph#2634 ·
Los mantenedores suelen responder en 1 día
-
Windows: bundled Node v24.16.0 can abort at exit (nodejs/node#56645); please bundle Node >= 24.20.0Posiblemente ocupada @Ancienttwo la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
colbymchenry/codegraph#2617 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Invalid regular expression: /\boperator++\s*(?:<[^<>()]*>)?\s*\(/: Nothing to repeat (v1.6.2)Abierto
Dificultad 2/5 Menos de una hora Aptitud para principiantes 72/100
colbymchenry/codegraph#2482 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
codegraph ui - does not workAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
colbymchenry/codegraph#1900 · 2 comentarios · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
colbymchenry/codegraph#1700 ·
Los mantenedores suelen responder en 1 día
Todos los issues de colbymchenry/codegraph
Issues similares
-
mewencode: base256[] and base128[] are indexed out of bounds by a non-ASCII octetPosiblemente ocupada @kazu-yamamoto la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
kazu-yamamoto/Mew#276 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
FujiNetWIFI/fujinet-firmware#2045 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
[Performance]: Qwen-Image-2.1 CPU-only on i5-10500H (6C AVX2, 32 GB): 512x512 in 7.7 min at 8 stepsAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
area:gates area:gfx found-by:critic kind:gate-defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
InauguralSystems/EigenScript#1825 ·
Los mantenedores suelen responder en 1 día