Commit Graph
7267 Commits
Author SHA1 Message Date
Nikola Jichev c9f1f039c8 Fix function typos (#7507) 2018-03-28 12:24:21 +02:00
Nikola Jichev f963013036 Add Function module for introspecting functions (#7503)
Reason to add it is capturing functions when passing in module name,
function name and arity using variable, because the capture operator
can't handle them.

Done by delegating to `:erlang.make_fun(mod, f, arity)`, also exposed
some erlang functions for getting information for a function.
2018-03-28 11:52:00 +02:00
Adi Iyengar 8d47d0d238 Fix typo in formatter (#7504) 2018-03-28 10:45:17 +02:00
José Valim 740a815bb4 Document @impl true automatically sets @doc false
Closes #7505.
2018-03-28 10:26:28 +02:00
Andrea Leopardi ae6fb479b5 Remove a useless guard in elixir_tokenizer 2018-03-27 12:32:42 +02:00
José Valim 91e8a76bfb Fix swapped cursor_left and cursor_right
Closes #7496.
2018-03-27 10:46:59 +02:00
Glauber Campinho 0757cf8028 Optimize tokenizer for commas (#7493)
Small optimization skipping the `handle_terminator` function
for commas since they don't require terminators.
2018-03-26 22:31:58 +02:00
José Valim 399bd14f0e tiny -> patch 2018-03-26 16:17:41 +02:00
José Valim 09e25a75d0 Support specsdiff __info__ spec clauses, closes #7460 (#7461) 2018-03-26 16:04:20 +02:00
José Valim 27c15d04fb Outline versioning schema and support, closes #7489 2018-03-26 13:31:17 +02:00
José Valim cf6e610afe Avoid multiple check calls in remote 2018-03-25 22:28:12 +02:00
Glauber Campinho a4ed1c93f9 Improve error messages for lists concatenation operator (#7487) 2018-03-25 22:20:58 +02:00
Scott Thompson 10b538c23b Pass a function StringIO.open to allow the device to be closed automatically (#7477) 2018-03-25 12:52:43 +02:00
Glauber Campinho 4923b8708f Improve error message for invalid clauses inside local functions (#7484) 2018-03-25 12:52:14 +02:00
Glauber Campinho add3a9666f Fix column count on heredoc tokenizer (#7486) 2018-03-25 12:37:15 +02:00
Michał Muskała 946455ec42 Validate @compile attribute in elixir (#7476)
* error on undefined inlined functions
* warn on parse transforms
2018-03-25 09:52:36 +02:00
Martin Svalin 5c814ae038 Doc improvement to Regex functions with option return: :index (#7481) 2018-03-24 07:22:38 +01:00
Gaoxiang Yang 7a829c5735 Fix a typo in the docs for quote (#7483) 2018-03-24 00:02:16 +01:00
José Valim d0378be1e7 Improve docs for with special form 2018-03-22 01:08:59 +01:00
José Valim ac1af198c8 Move accumulate attributes to a separate table (#7472)
We also speed up reading and writing of attributes via the @ macro.
2018-03-21 17:13:43 +01:00
José Valim a5a8ad3eaa Refactor how typespecs docs are stored 2018-03-20 18:03:02 +01:00
José Valim 0ce9ea6188 Keep specs, types and callbacks in the bag table
This avoids copying typespecs in and out of the table
every time there is a new entry.

We also make sure the Protocol module is only relying
on public APIs and not on inner typespec behaviour.
2018-03-20 18:03:02 +01:00
José Valim d297fe5195 Avoid full table traversals when building "deprecated" and "docs" chunk 2018-03-20 18:03:02 +01:00
José Valim eb2418d4b1 Remove locals tracker table
Instead we use the bag and set tables accordingly.
2018-03-20 18:03:02 +01:00
Andrea Leopardi 1d14366ba4 Improve one test in the Inspect.Algebra test case 2018-03-20 14:48:01 +01:00
José Valim 8c85557346 Share Bag and Set tables across a module functionality
Previously we kept a Set table for attributes and a Bag table
for function definitions and clauses. This led to suboptimal
usage of ets tables.

With this commit, we start using both Bag and Set tables
to store function/macro definition information. In the next
commits we will continue generalizing the tables, storing
specs, docs and accumulated attributes in the Bag and keep
the remaining functionality in Set.
2018-03-20 10:30:37 +01:00
Michał Muskała 8958f9eea6 Skip :ets.update_element/3 call if attribute was already read (#7466) 2018-03-19 18:53:17 +01:00
José Valim 0995a5a14f Reduce amount of data in IEx history 2018-03-19 10:28:31 +01:00
José Valim 4f14aea9f6 Split Kernel.Typespec into Kernel.Typespec and Code.Typespec (#7462)
Kernel.Typespec will be responsible for handling typespec
logic during compilation, such as definitions, conversion to
Erlang and warnings. Its API shall never be public.

Code.Typespec will handle the runtime aspects, such as reading
from .beam files and conversion back to Elixir AST. Its API
may be made public in the future but it is currently private.

This PR also simplifies definition of typespecs internally by
avoiding multiple macro passes and speeds up typespec processing
on OTP 20+ by skipping the translation pass from Elixir to Erlang.

The test suite was also reorganized and made async: true.
2018-03-18 22:45:44 +01:00
José Valim 43fd9f4b5a Move context and side matching up in <>'s implementation 2018-03-18 17:49:05 +01:00
Glauber Campinho b5e1a76699 Improve error messages for <> operator (#7349) 2018-03-18 17:41:37 +01:00
Giuseppe Modarelli e54791c56a Add the ability to count the number of keys in a Registry (#7456) 2018-03-18 13:16:03 +01:00
José Valim 141c327685 Ensure bitstring comprehensions work on OTP 20.3 (#7453)
Closes #7452
2018-03-14 21:45:13 +01:00
José Valim d0bd8692dd Do not escape quoted keywords on formatting, closes #7451 2018-03-14 10:10:44 +01:00
Damien Krotkine 14147ed883 Remove comma from operators table (#7450) 2018-03-13 23:42:02 +01:00
Carlos Henrique 42dd2e5870 Updated NaiveDateTime moduledoc to use new/8 (#7446) 2018-03-13 07:41:20 +01:00
Aleksei Magusev 37c3104d5e Remove unnecessary argument in a helper function in StringIOTest 2018-03-11 12:25:17 +01:00
Aleksei Magusev bc7043cbe9 Improve name of child with extra_arguments restarting test 2018-03-11 12:16:38 +01:00
José Valim 6b968fdef9 Avoid protocol dispatch and multiple lists conversion in the formatter 2018-03-10 23:18:44 +01:00
Fernando Tapia Rico 1bfee449f9 Add missing paren in Map documentation (#7439) 2018-03-10 21:19:14 +01:00
Andrea Leopardi 6cbe849d58 Modernize Kernel.Typespec by reducing usage of :lists functions (#7437) 2018-03-10 13:51:17 +01:00
Andrea Leopardi bf956e2afb Extract some functionality from elixir_erl to Kernel.Typespec (#7436) 2018-03-10 12:04:13 +01:00
Andrea Leopardi 875ce67673 Implement check for @spec attributes for undefined functions (#7431) 2018-03-09 11:31:15 +01:00
Johan Suleiko Allansson 24790a80ba Properly cancel timeout on compilation error in ParallelCompiler #7428 (#7429)
The :timed_out message was not cancelled properly when compilation failed in ParallelCompiler. This meant the timeout message would be delivered even after compilation completed. This could be problematic when invoking compilation programmatically via e.g. Mix.Task.run("compile", ["--return-errors"]) since it means that the calling process, depending on the implemenation, might crash unexpectedly or get its inbox filled with messages.

The fix simply calls the cancel_waiting_timer when a compilation error has ocurred in the same way it is called in other similar cases.
2018-03-08 13:38:29 +01:00
Andrea Leopardi 2dee728a3e Add a "erl_lint" check for behaviour_info/1 plus callback attributes (#7422)
Part of #5800.
2018-03-07 22:48:53 +01:00
José Valim 0126cdd253 Ensure proper reports from named DynamicSupervisor, closes #7425 2018-03-07 12:28:52 +01:00
Kip Cole d91aed218e Add calendar callback months_in_year/1 (#7417)
Not all calendars have a constant 12 months in
a year.  This function returns the number of
months for a given year. Calendar.ISO will return
12 for all years.

Add Date.days_in_month/1
Date.days_in_month/1 takes a Date.t and
delegates to the Date's calendar to invoke
days_in_month/1 in the calendar module.
2018-03-05 10:26:05 +01:00
Eric Meadows-Jönsson d8dbc6f2cb Fix table column alignment with ANSI escapes (#7415) 2018-03-04 18:34:33 +01:00
Nathan Long 3cd378cd90 Add a simple example at the top of the "Typespecs" page (#7413)
[ci skip]
2018-03-03 11:46:15 +01:00
Jay Hayes 7cbba67461 Extend Macro.escape/2 docs to illustrate difference from quote/2 (#7407) 2018-03-03 00:40:27 +01:00