Commit Graph
8092 Commits
Author SHA1 Message Date
Eksperimental 84f9128825 Replace use of "item(s)" with "element(s)" in Enum module (#8885) 2019-03-12 23:24:22 +01:00
Eksperimental 180bf41c25 Add an example that actually decodes to URI.query_decoder/2 (#8880) 2019-03-12 22:10:19 +01:00
Fernando Tapia Rico 0903ad17bc Ensure inspect returns valid ~r// expressions (#8872)
Inspecting regular expressions that contain backslashes (\)
followed by slashes (/) result in invalid ~r// expressions:

    iex(1)> Regex.compile("a\\/b")
    {:ok, ~r/a\\/b/}
    iex(2)> Regex.match?(~r/a\\/b/, "a/b")
    ** (SyntaxError) iex:2: syntax error before: ','
2019-03-11 13:57:43 +01:00
Caleb McQuillin 4043bd8de6 Fix small typo for ceil behavior docs (#8874) 2019-03-11 09:22:33 +01:00
Fernando Tapia Rico a7019ac90a Use inspect/1 with values returned by __struct__/* (#8873)
__struct__/0,1 is not meant to return an AST. Using
Macro.to_string/1 might lead to incorrect error messages:

    defmodule MyStruct do
      def __struct__, do: {:ok, :one, :two}
      def __struct__(_), do: {:ok, :one, :two}
    end

    iex> %MyStruct{}
    ** (CompileError) iex:2: expected MyStruct.__struct__/1 to
       return a map with a :__struct__ key that holds the name
       of the struct (atom), got: ok
2019-03-08 23:24:45 +01:00
Fernando Tapia Rico 7cac527c9e Add guard to Macro.to_string/2 (#8870) 2019-03-08 22:51:11 +01:00
Fernando Tapia Rico 9cfd989f4b Use :elixir_aliases.inspect/1 with module aliases (#8869)
The `Module` variable in these cases is guaranteed to be a module
alias.
2019-03-08 22:49:55 +01:00
Tom Nicklin c8e054a7f2 More examples for Kernel.function_exported?/3 (#8865) 2019-03-07 18:06:11 +01:00
Fernando Tapia Rico b88cd49d8d Validate __struct__ key in map returned by __struct__/0,1 (#8864) 2019-03-07 12:12:30 +01:00
Niels Bom cd80616924 Tiny docs change falsy value (#8859) 2019-03-04 13:25:30 +01:00
Eksperimental 4c3967339c Use in instead of on (#8854) 2019-03-04 10:29:28 +01:00
Eksperimental 4f645c3289 Improve clarification on string() type replacements in Typespecs page (#8857) 2019-03-04 02:25:30 -06:00
Eksperimental af47fb24a8 Avoid hyphen at EOL (#8853)
Avoid splitting words that contain a hyphen into two lines,
since a space is added when docs are rendered in IEx and ExDoc.

Command used to detect this bug:

$ ag -- "\w-\n"
2019-03-04 02:22:12 -06:00
José Valim 243cbb5453 Update Syntax Reference.md 2019-03-04 09:20:53 +01:00
Eksperimental f036f6592c Improvements in the documentation (#8856) 2019-03-04 02:18:50 -06:00
Eksperimental 23b2a09079 Improve error message on invalid @doc (#8852) 2019-03-03 18:22:15 -08:00
SpaceEEC 33d484231b Ensure :name is given in Registry.start_link/1 (#8850) 2019-03-03 17:07:01 -08:00
Eksperimental 8d00745217 Replace "(un)defined" with "(un)set" for system env (#8851) 2019-03-03 23:35:34 +01:00
Niels Bom 1a9a6bb806 Clarify Enum.all? and Enum.any? for empty lists (#8849) 2019-03-03 23:28:28 +01:00
Niels Bom ce92d83e3e Add docs for truthy/falsy values (#8848)
In a number of places in the docs (`!/`, `&&/2`, `Enum.all?`) the
concept of a truthy/falsy value is mentioned and briefly explained.
Let's have single place for that explanation and point to it
from those other places.
2019-03-03 13:19:03 -08:00
Andrea Leopardi 3680e85355 Add System.fetch_env/1 and System.fetch_env!/1 (#8846)
This commit adds the System.fetch_env/1 and System.fetch_env!/1 
functions as per the discussion in 
https://groups.google.com/forum/#!topic/elixir-lang-core/QGxEibK4y7Q.

I chose to keep using the same underlying implementation for fetch_env/1 
as the one for get_env/1 because the number of lines would have been the 
same but we would have added one function call.
2019-03-01 12:32:31 -08:00
Carlo Colombo fc039770b4 Enable Access.at/1 to handle negative index (#8843)
Enabling negative index as Enum.at/2 to keep it consistent.
2019-03-01 10:03:10 -08:00
José Valim 954f276a96 Do not change super signature, pass info as metadata 2019-03-01 08:58:53 -08:00
José Valim af9fea4aad Supervisor.start_link/2 with a list of children cannot return ignore
Closes #8845.
2019-03-01 06:45:19 -08:00
Andrea Leopardi 0558e7c92a Slightly improve Macro.generate_arguments/2 (#8842)
I added a bodyless clause so that arguments are clearly named in the 
documentation. I also added a is_atom/1 guard to the first function 
clause so that we consistently check that the context is an atom.
2019-03-01 06:33:15 +01:00
Tobiasz Małecki 9e387ce198 Add typespec for Macro.generate_arguments/2 (#8840) 2019-03-01 00:06:46 +01:00
Fernando Tapia Rico cae8c328bd Avoid Dialyzer warnings on Inspect (#8841)
Closes #8749.
2019-02-28 23:45:03 +01:00
Andrea Leopardi 12953fe8da Remove StreamData-related stuff from the formatter configuration (#8833)
We're not including StreamData (https://github.com/whatyouhide/stream_data) in the standard library anymore. It doesn't make sense that we have StreamData functions in the default locals without parens of the formatter. Instead, we solve the problem on the StreamData side with https://github.com/whatyouhide/stream_data/pull/124.
2019-02-28 23:34:39 +01:00
Andrew Kappen ea445b1300 Allow atime, mtime, ctime to have integer() types (#8839) 2019-02-27 17:44:30 -08:00
José Valim 28b5df2be2 Check for timeout to blame clauses, closes #8837 2019-02-27 09:45:11 -08:00
Fernando Tapia Rico 0a81b27861 Raise if a macro is invoked before its definition (#8822) 2019-02-25 22:48:21 +01:00
Wojtek Mach b819b9f093 Add ~U sigil for UTC date times (#8824) 2019-02-25 15:01:12 +01:00
Wojtek Mach ff25707c73 Set DateTime.from_unix precision to microseconds for units not divisible by 10 (#8823)
Before:

    DateTime.from_unix!(143_256_036_886_856, 1024).microsecond
    {320312, 3}

After:

    DateTime.from_unix!(143_256_036_886_856, 1024).microsecond
    {320312, 6}
2019-02-24 16:04:43 +01:00
Fernando Tapia Rico 34e0fcd923 Do not allow to override macros as functions (#8816)
And vice-versa.

Overriding a macro as a function (and vice-versa) might produce
undesired effects.

For example, it's not clear if the following code should or
should not raise:

    defmodule Foo do
      def foo, do: bar()
      defmacro bar, do: :ok
      defoverridable bar: 0
      def bar, do: :ok
    end

On top of that, `super` does not currently work for such cases.
2019-02-23 09:08:16 +01:00
Page Bobby McConnell Grayson 6c88543e7f Fix uncommented ... in periodic task genserver documentation (#8820) 2019-02-23 09:07:50 +01:00
Gustavo Saiani 8c27da88c7 Fix typos in Kernel.SpecialForms (#8819) 2019-02-22 21:16:00 +01:00
Adam Zapaśnik 74cbc8f0ea Raise error when doc attribute is true (#8814) 2019-02-21 12:39:28 +01:00
José Valim 4f819651eb Use proper var_context in with optimization 2019-02-19 23:20:34 +01:00
Colin Jones 4982cb52ed Update docs to consistently use "keyword list" (#8808) 2019-02-19 09:38:53 +01:00
Fernando Tapia Rico 6595283c35 Improve defoverridable test suite (#8802) 2019-02-18 07:15:22 +01:00
m. simon borg 8add228591 Fix documentation typos (#8805)
Fixed a few typos in the documentation section of `terminate/2`
2019-02-18 07:14:49 +01:00
Rauan Assis 4dda125e78 Adding missing List functions tests (#8804) 2019-02-18 07:14:23 +01:00
Fernando Tapia Rico 1aeb445b40 Store overridable information more efficiently (#8799)
This is part of an ongoing effort to forbid overriding macros
with functions and vice-versa. New checks will require the
overridable information to be stored more efficiently.
2019-02-16 16:05:54 +01:00
Eksperimental a14fe3184a Improvements to the URI module (#8779) 2019-02-16 11:19:40 +01:00
Aaron Renner a190c58680 Allow integer time units for DateTime.from_unix!/2 (#8801) 2019-02-15 19:57:04 +01:00
Gustavo Saiani c1bc409cc7 Improve Kernel.SpecialForms docs (#8798) 2019-02-15 14:09:40 +01:00
José Valim 819114b850 Specify that the formatter behaviour for operators has been generalized 2019-02-14 18:47:23 +01:00
Robb Shecter ddaa3f6ccb Focus on defguard in the "Guards" page (#8795)
The current doc first describes in detail the _deprecated_ way to create a custom guard. Only after that's complete is there a small note saying that this isn't recommended, and instead to use `defguard`. This commit changes that order around to lead with the current recommended practice.
2019-02-14 08:53:44 +01:00
Sebastian Abondano 58c86e1fcf Improve Task.Supervisor.async_nolink/3 doc (#8794) 2019-02-13 23:05:11 +01:00
Sebastian Abondano d4f7f5e5be Fix typo in Task.Supervisor.async_nolink/3 doc (#8793)
[ci skip]
2019-02-13 17:22:52 +01:00