Skip to content

Annotate @doc metadata when a function is inlined #7905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/elixir/lib/atom.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defmodule Atom do
"foo"

"""
@doc inlined: true
@spec to_string(atom) :: String.t()
def to_string(atom) do
:erlang.atom_to_binary(atom, :utf8)
Expand All @@ -32,6 +33,7 @@ defmodule Atom do
'An atom'

"""
@doc inlined: true
@spec to_charlist(atom) :: charlist
def to_charlist(atom) do
:erlang.atom_to_list(atom)
Expand Down
6 changes: 3 additions & 3 deletions lib/elixir/lib/function.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defmodule Function do
&String.length/1

"""
@doc since: "1.7.0"
@doc since: "1.7.0", inlined: true
@spec capture(module, atom, arity) :: fun
def capture(module, function_name, arity) do
:erlang.make_fun(module, function_name, arity)
Expand Down Expand Up @@ -93,7 +93,7 @@ defmodule Function do
:length

"""
@doc since: "1.7.0"
@doc since: "1.7.0", inlined: true
@spec info(fun) :: [{information, term}]
def info(fun), do: :erlang.fun_info(fun)

Expand Down Expand Up @@ -131,7 +131,7 @@ defmodule Function do
{:pid, :undefined}

"""
@doc since: "1.7.0"
@doc since: "1.7.0", inlined: true
@spec info(fun, item) :: {item, term} when item: information
def info(fun, item), do: :erlang.fun_info(fun, item)
end
4 changes: 4 additions & 0 deletions lib/elixir/lib/integer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ defmodule Integer do
"123"

"""
@doc inlined: true
@spec to_string(integer) :: String.t()
def to_string(integer) do
:erlang.integer_to_binary(integer)
Expand All @@ -315,6 +316,7 @@ defmodule Integer do
"ELIXIR"

"""
@doc inlined: true
@spec to_string(integer, 2..36) :: String.t()
def to_string(integer, base) do
:erlang.integer_to_binary(integer, base)
Expand All @@ -340,6 +342,7 @@ defmodule Integer do
'123'

"""
@doc inlined: true
@spec to_charlist(integer) :: charlist
def to_charlist(integer) do
:erlang.integer_to_list(integer)
Expand All @@ -364,6 +367,7 @@ defmodule Integer do
'ELIXIR'

"""
@doc inlined: true
@spec to_charlist(integer, 2..36) :: charlist
def to_charlist(integer, base) do
:erlang.integer_to_list(integer, base)
Expand Down
2 changes: 2 additions & 0 deletions lib/elixir/lib/io.ex
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ defmodule IO do
<<1, 2, 3>>

"""
@doc inlined: true
@spec iodata_to_binary(iodata) :: binary
def iodata_to_binary(item) do
:erlang.iolist_to_binary(item)
Expand All @@ -509,6 +510,7 @@ defmodule IO do
4

"""
@doc inlined: true
@spec iodata_length(iodata) :: non_neg_integer
def iodata_length(item) do
:erlang.iolist_size(item)
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/lib/io/ansi/docs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ defmodule IO.ANSI.Docs do
print_each_metadata(metadata, options) && IO.write("\n")
end

@metadata_filter [:deprecated, :guard, :since]
@metadata_filter [:deprecated, :guard, :inlined, :since]

defp print_each_metadata(metadata, options) do
Enum.reduce(metadata, false, fn
Expand Down
Loading