Skip to content

Find Usages and the rename dialog show no type label for a defguard #3958

Description

@sh41

CallDefinitionClause.elementDescription branches on isFunction and isMacro only, returning
null for anything else. Since 7880a14c8 (v11.11.0) made a defguard/defguardp clause match
CallDefinitionClause.is, ElementDescriptionProvider reaches that method for guards and passes the
null straight through.

The effect is a blank type label: Find Usages and the rename dialog say "function" for a def and
"macro" for a defmacro, but nothing for a defguard. Resolution, completion and the rename itself
are unaffected — this is the label text only.

To reproduce, put the caret on is_even and press Shift+F6, or Alt+F7:

defmodule Guards do
  defguard is_even(value) when rem(value, 2) == 0

  def check(value) when is_even(value), do: :even
end

Filed as part of an AI-assisted review of the backlog. A human checked this one before it was filed,
but it might still be wrong — if any of it is, please say so here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions