Skip to content

Commit

Permalink
Make sure put_attribute still returns a quoted expression
Browse files Browse the repository at this point in the history
  • Loading branch information
José Valim committed Dec 9, 2016
1 parent f672206 commit b3876cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/elixir/lib/calendar.ex
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ defmodule Calendar do
@callback date_to_string(year, month, day) :: String.t

@doc """
Coverts the date time (without time zone) into a string according to the calendar.
Converts the date time (without time zone) into a string according to the calendar.
"""
@callback naive_datetime_to_string(year, month, day, hour, minute, second, microsecond) :: String.t

Expand Down
13 changes: 6 additions & 7 deletions lib/elixir/lib/module.ex
Original file line number Diff line number Diff line change
Expand Up @@ -843,16 +843,14 @@ defmodule Module do
@doc """
Puts a module attribute with key and value in the given module.
It returns the value of the attribute after normalization.
## Examples
defmodule MyModule do
Module.put_attribute __MODULE__, :custom_threshold_for_lib, 10
end
"""
@spec put_attribute(module, key :: atom, value :: term) :: term
@spec put_attribute(module, key :: atom, value :: term) :: :ok
def put_attribute(module, key, value) do
put_attribute(module, key, value, nil, nil)
end
Expand Down Expand Up @@ -920,9 +918,10 @@ defmodule Module do
end

@doc """
Registers an attribute. By registering an attribute, a developer
is able to customize how Elixir will store and accumulate the
attribute values.
Registers an attribute.
By registering an attribute, a developer is able to customize
how Elixir will store and accumulate the attribute values.
## Options
Expand Down Expand Up @@ -1076,7 +1075,7 @@ defmodule Module do
:ets.insert(table, {key, value, false, unread_line})
end

value
:ok
end

## Helpers
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/test/elixir/module_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ defmodule ModuleTest do

test "module attributes returns value" do
in_module do
assert (@return [:foo, :bar]) == [:foo, :bar]
assert (@return [:foo, :bar]) == :ok
_ = @return
end
end
Expand Down

0 comments on commit b3876cc

Please sign in to comment.