Commit e891b1a
Don't add compile-time dependency on defdelegate (#10093)
The dependency doesn't seem needed in this case.
We go through extra hoops to maintain dynamic invocations where
`opts` is not a compile-time list and :to is not a literal.
An easy way to see this optimization is:
defmodule A do
defdelegate f(), to: B
end
defmodule B do
def f() do
:ok
end
end
$ touch lib/b.ex && mix compile --verbose
Compiling 1 file (.ex)
Compiled lib/b.ex
vs:
defmodule A do
opts = [to: B]
defdelegate f(), opts
end
defmodule B do
def f() do
:ok
end
end
$ touch lib/b.ex && mix compile --verbose
Compiling 2 files (.ex)
Compiled lib/b.ex
Compiled lib/a.ex1 parent 001a5eb commit e891b1a
File tree
2 files changed
+29
-0
lines changed- lib/elixir
- lib
- test/elixir/kernel
2 files changed
+29
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4881 | 4881 | | |
4882 | 4882 | | |
4883 | 4883 | | |
| 4884 | + | |
| 4885 | + | |
| 4886 | + | |
| 4887 | + | |
| 4888 | + | |
| 4889 | + | |
| 4890 | + | |
| 4891 | + | |
| 4892 | + | |
| 4893 | + | |
| 4894 | + | |
| 4895 | + | |
4884 | 4896 | | |
4885 | 4897 | | |
4886 | 4898 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
129 | 146 | | |
0 commit comments