Skip to content

Elixir: defmacro/defmacrop/defguard/defguardp definitions are dropped #4023

Closed

Description

@rajatnagda45

Summary

Elixir macros and guard macros are not extracted. A module's defmacro, defmacrop, defguard and defguardp definitions produce no nodes, and a call to a locally-defined macro resolves to nothing.

Repro

defmodule MyMod do
  defmacro trace(expr) do
    quote do: unquote(expr)
  end
  defguard is_even(x) when is_integer(x) and rem(x, 2) == 0
  def run(x) do
    trace(x)
  end
end

run() is captured but trace/is_even are missing, and there is no run -> trace edge.

Cause

Only def/defp are handled in the call-keyword dispatch. defmacro/defmacrop/defguard/defguardp share the exact same head shape (a call head, optionally wrapped in a when binary_operator) but fall through to the generic recursion and are dropped.

Expected

Treat them like def/defp — macros and guard macros are named, invocable members. They are already in the call-pass skip-keyword set, so their own keyword is never mistaken for a call.

Fix + regression test ready.

Activity

  1. github-actions commented on Oct 3, 2026

    @github-actions

    Thanks for opening this issue, @rajatnagda45. 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.

  2. safishamsi commented on Oct 4, 2026

    @safishamsi
    Member

    Fixed in v0.9.75 (live on PyPI as graphifyy==0.9.75) via #4027, thanks @rajatnagda45. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions