-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
Elixir and Erlang/OTP versions
Erlang/OTP 25 [erts-13.2.2.5] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
Elixir 1.15.7 (compiled with Erlang/OTP 25)
Operating system
Linux asrock-x300 6.1.71 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jan 5 14:18:41 UTC 2024 x86_64 GNU/Linux
Current behavior
Corrected example of private macros doesn't work in Elixir 1.15 (but works in 1.14)
iex(1)> defmodule Sample do
...(1)> defmacrop two, do: 2
...(1)> def four, do: two + two
...(1)> end
error: undefined variable "two"
iex:9: Sample.four/0
error: undefined variable "two"
iex:9: Sample.four/0
warning: macro two/0 is unused
iex:8: Sample (module)
** (CompileError) iex: cannot compile module Sample (errors have been logged)
(elixir 1.15.7) elixir_module.erl:182: anonymous fn/9 in :elixir_module.compile/7
iex:7: (file)But it works with parenthesis
iex(1)> defmodule Sample do
...(1)> defmacrop two, do: 2
...(1)> def four, do: two() + two()
...(1)> end
{:module, Sample,
<<70, 79, 82, 49, 0, 0, 5, 124, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 169,
0, 0, 0, 17, 13, 69, 108, 105, 120, 105, 114, 46, 83, 97, 109, 112, 108, 101,
8, 95, 95, 105, 110, 102, 111, 95, 95, ...>>, {:four, 0}}
iex(2)> Sample.four
4
Expected behavior
Private macro without parenthesis should work.
Metadata
Metadata
Assignees
Labels
No labels