Skip to content

warning reports a misleading message on unused default arguments #10095

@DaTrader

Description

@DaTrader

Environment

  • Elixir & Erlang/OTP versions (elixir --version): 1.10.3 / OTP 22
  • Operating system: Linux Mint

Current behavior

A private function taking n arguments, say 5 with the last two set to default values, when compiled without another function in the module ever invoking it with less than 4 arguments, gives a misleading warning message:
warning: the first 4 default arguments in foo/5 are never used
ex:

defp foo( arg1, arg2, arg3, arg4 \\ nil, arg5 \\ nil) do
..
end

Expected behavior

The warning message should read something like:
warning: the default value for argument no. 4 in foo/5 is never used

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions