Elixir: defdelegate function definitions are dropped

Abierto
#4,132 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #4133 de @rajatnagda45 — cerrado sin fusionar

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
elixir, python
Área
devtools

Línea de trabajo

Start with extract_elixir and the def-handling keyword set mentioned in the issue. Run the supplied facade.ex reproduction and inspect the extracted nodes and calls. Done means start and stop appear as function nodes and run has calls to both; a linked pull request is already open.

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

defdelegate name(args), to: Mod defines a real, public module function (it forwards its body to another module), but it is not extracted. The delegated function never becomes a node, and an intra-module call to it resolves to nothing — so parts of a module's public surface vanish from the graph.

Minimal reproduction
# facade.ex
defmodule Facade do
  defdelegate start(x), to: Worker
  defdelegate stop(x), to: Worker, as: :halt

  def run(x) do
    start(x)
    stop(x)
  end
end
from graphify.extract import extract_elixir
r = extract_elixir("facade.ex")
print(sorted((n.get("label") or "").rstrip("()") for n in r["nodes"]))
# -> ['Facade', 'facade.ex', 'run']   # start / stop missing
print([(e["source"], e["target"]) for e in r["edges"] if e["relation"] == "calls"])
# -> []   # run -> start, run -> stop unresolved
Expected vs actual
  • Expected: start and stop function nodes, with run --calls--> start and run --calls--> stop.
  • Actual: the delegated functions are absent and the calls dangle.
Root cause

defdelegate has the same call head shape as def (its first argument is the function signature), but it is not in the def-handling keyword set, so it falls through to the generic recursion and is dropped.

A clean checkout of v8 reproduces it. Fix PR to follow.

Lenguaje dominante
Python
Estrellas
124k
Forks
11.9k
Merge medio
2 h 35 min
PR fusionados (30 d)
6

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Graphify-Labs/graphify

Todos los issues de Graphify-Labs/graphify

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.