Scala: given...with instance methods leak to the file and collide with same-named trait methods
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #4131 de @rajatnagda45 — cerrado sin fusionar
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start by reading the Scala extraction path exposed as extract_scala and how class_types handles given_definition and with_template_body. Use the given.scala reproduction to check the graph. Done means intShow owns show and helper, the call stays within the given, and the trait's show node is untouched.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version / commit
v0.9.77 (v8 @ 5c7b847)
Environment
macOS, Python 3.13, clean checkout of v8.
What happens
A Scala 3 given name: T with { ... } instance owns method implementations, but it is not modelled as a container. Its methods leak to the file node, and when a given method shares a name with a method of the trait it implements (the normal case — it IS the implementation), the leaked file-level node collides with the trait's method node. The trait node then wrongly carries the given's call/reference edges, corrupting the graph.
Minimal reproduction
// given.scala
trait Show[A]:
def show(a: A): String
given intShow: Show[Int] with
def show(a: Int): String = helper(a)
def helper(a: Int): String = a.toString
from graphify.extract import extract_scala
r = extract_scala("given.scala")
print([n["label"] for n in r["nodes"]])
# -> no 'intShow' node; a stray file-level 'helper' appears
print([(e["source"], e["target"]) for e in r["edges"] if e["relation"] == "calls"])
# the show -> helper call is attributed to the TRAIT's show node, not the given's
Expected vs actual
- Expected: an
intShownode owningshow/helper; theshow -> helpercall stays inside the given; the trait node is untouched. - Actual: no given node; methods leak to the file; the trait
shownode is polluted with the given's edges.
Root cause
given_definition is absent from the Scala class_types, so the engine never opens a scope for its with_template_body; the members are walked as if they were file-level definitions and their ids collide with equally-named trait members.
A clean checkout of v8 reproduces it. Fix PR to follow.
- Lenguaje dominante
- Python
- Estrellas
- 124k
- Forks
- 11.9k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
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 Graphify-Labs/graphify
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Graphify-Labs/graphify#3763 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Graphify-Labs/graphify#3611 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Nix supportAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Graphify-Labs/graphify#3193 · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
Graphify-Labs/graphify#2871 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Graphify-Labs/graphify#2865 ·
Los mantenedores suelen responder en 1 día
Todos los issues de Graphify-Labs/graphify
Issues similares
-
good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
btclib-org/btclib-node#1955 ·
Los mantenedores suelen responder en 1 día
-
documentation v0.9.2
Dificultad 2/5 Medio día Aptitud para principiantes 72/100
khuisman/mcp-gee-sweet#1033 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ossf/cve-bin-tool#5966 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 2 días
-
write_iceberg ignores the table's write.parquet.compression-codec propertyPosiblemente ocupada @YuangGao la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Eventual-Inc/Daft#7606 ·
Los mantenedores suelen responder en 1 día