Skip to content

Commit e1158a5

Browse files
committed
Revert "Use an empty keyword list instead of nil for empty definitions"
This reverts commit 4477115.
1 parent 78cc8be commit e1158a5

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4104,7 +4104,7 @@ defmodule Kernel do
41044104
end
41054105
41064106
"""
4107-
defmacro def(call, expr \\ []) do
4107+
defmacro def(call, expr \\ nil) do
41084108
define(:def, call, expr, __CALLER__)
41094109
end
41104110

@@ -4134,7 +4134,7 @@ defmodule Kernel do
41344134
** (UndefinedFunctionError) undefined function Foo.sum/2
41354135
41364136
"""
4137-
defmacro defp(call, expr \\ []) do
4137+
defmacro defp(call, expr \\ nil) do
41384138
define(:defp, call, expr, __CALLER__)
41394139
end
41404140

@@ -4162,7 +4162,7 @@ defmodule Kernel do
41624162
end
41634163
41644164
"""
4165-
defmacro defmacro(call, expr \\ []) do
4165+
defmacro defmacro(call, expr \\ nil) do
41664166
define(:defmacro, call, expr, __CALLER__)
41674167
end
41684168

@@ -4178,7 +4178,7 @@ defmodule Kernel do
41784178
naming and default arguments.
41794179
41804180
"""
4181-
defmacro defmacrop(call, expr \\ []) do
4181+
defmacro defmacrop(call, expr \\ nil) do
41824182
define(:defmacrop, call, expr, __CALLER__)
41834183
end
41844184

@@ -4673,7 +4673,7 @@ defmodule Kernel do
46734673
macro_definition =
46744674
case impls do
46754675
[] ->
4676-
define(kind, call, [], env)
4676+
define(kind, call, nil, env)
46774677

46784678
[guard] ->
46794679
quoted =

lib/elixir/src/elixir_bootstrap.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
'MACRO-@'(Caller, Tree) ->
1111
unless_loaded('MACRO-@', [Caller, Tree], fun() -> nil end).
1212

13-
'MACRO-def'(Caller, Call) -> 'MACRO-def'(Caller, Call, []).
13+
'MACRO-def'(Caller, Call) -> 'MACRO-def'(Caller, Call, nil).
1414
'MACRO-def'(Caller, Call, Expr) -> define(Caller, def, Call, Expr).
1515
'MACRO-defp'(Caller, Call, Expr) -> define(Caller, defp, Call, Expr).
1616

17-
'MACRO-defmacro'(Caller, Call) -> 'MACRO-defmacro'(Caller, Call, []).
17+
'MACRO-defmacro'(Caller, Call) -> 'MACRO-defmacro'(Caller, Call, nil).
1818
'MACRO-defmacro'(Caller, Call, Expr) -> define(Caller, defmacro, Call, Expr).
1919
'MACRO-defmacrop'(Caller, Call, Expr) -> define(Caller, defmacrop, Call, Expr).
2020

lib/elixir/src/elixir_def.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ run_with_location_change(File, #{file := File} = E, Callback) ->
212212
run_with_location_change(File, E, Callback) ->
213213
elixir_lexical:with_file(File, E, Callback).
214214

215-
def_to_clauses(_Kind, Meta, Args, [], [], E) ->
215+
def_to_clauses(_Kind, Meta, Args, [], nil, E) ->
216216
check_args_for_function_head(Meta, Args, E),
217217
[];
218218
def_to_clauses(_Kind, Meta, Args, Guards, [{do, Body}], _E) ->

lib/iex/test/iex/helpers_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ defmodule IEx.HelpersTest do
382382
"* def left == right\n\n @spec term() == term() :: boolean()\n\nguard: true\n\nReturns `true` if the two terms are equal.\n\n"
383383

384384
def_h =
385-
"* defmacro def(call, expr \\\\ [])\n\nDefines a public function with the given name and body."
385+
"* defmacro def(call, expr \\\\ nil)\n\nDefines a public function with the given name and body."
386386

387387
assert capture_io(fn -> h(IEx.Helpers.pwd() / 0) end) =~ pwd_h
388388
assert capture_io(fn -> h(IEx.Helpers.c() / 2) end) =~ c_h

0 commit comments

Comments
 (0)