We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36e6261 commit 8b66976Copy full SHA for 8b66976
lib/elixir/lib/macro.ex
@@ -246,6 +246,10 @@ defmodule Macro do
246
end
247
248
# Unary ops
249
+ def to_binary({ :not, _, [arg] }) do
250
+ "not " <> to_binary(arg)
251
+ end
252
+
253
def to_binary({ op, _, [arg] }) when op in unary_ops do
254
atom_to_binary(op, :utf8) <> to_binary(arg)
255
lib/elixir/test/elixir/macro_test.exs
@@ -245,6 +245,8 @@ defmodule MacroTest do
245
test :unary_ops_to_binary do
+ assert Macro.to_binary(quote do: not 1) == "not 1"
+ assert Macro.to_binary(quote do: not foo) == "not foo"
assert Macro.to_binary(quote do: -1) == "-1"
assert Macro.to_binary(quote do: @foo(bar)) == "@foo(bar)"
0 commit comments