-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
Elixir and Erlang/OTP versions
1.16.2, OTP-26
Operating system
Mac
Current behavior
Macro.underscore/1
takes as argument either an atom or a string:
@spec underscore(module() | atom() | String.t()) :: String.t()
def underscore(atom_or_string)
Looking at the function definition, atom must be associated with module:
def underscore(atom) when is_atom(atom) do
"Elixir." <> rest = Atom.to_string(atom)
underscore(rest)
end
We cannot therefore pass nil
, which is also an atom after all:
iex(1)> Macro.underscore(nil)
** (MatchError) no match of right hand side value: "nil"
(elixir 1.13.0) lib/macro.ex:1840: Macro.underscore/1
Should atoms that are not associated with modules be supported somehow by Macro.underscore/1
?
Expected behavior
To be discussed
Metadata
Metadata
Assignees
Labels
No labels