Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Macros used only by directives are marked unused. #1582

Description

@harrisi

Describe the bug
If a macro is only used by other directives, it's treated as unused.

To Reproduce

-module(foo).

-define(exports, [bar/0]).
-export(?exports).

bar() -> 0.
%% if bar is instead defined like this:
%% bar() -> ?exports.
%% it doesn't surface a warning.

Expected behavior
No warning of unused macro.

Actual behavior
Warning of unused macro.

Context

  • erlang_ls version (tag/sha): b8724fb
  • Editor used:
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Feb 17 2023 20:31:45)
macOS version - arm64
Included patches: 1-1307
  • LSP client used: coc.nvim version: 0.0.82-d1568d56 2023-09-29 19:43:34 +0800

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions