Commit Graph
226 Commits
Author SHA1 Message Date
José Valim 0e15f809bb Avoid race conditions on behaviour checks, closes #8568 2018-12-27 16:29:33 +01:00
José Valim 0c1df34645 Standardize more TODOs 2018-12-21 13:42:54 +01:00
Fernando Tapia Rico c190f09d5c Allow @type, @opaque, @typep, @spec, @callback, and @macrocallback to be used as module attributes (#8289)
Closes #8085
2018-10-18 22:45:13 +02:00
José Valim cd439540fc Revert wrong warning on parse_transforms removal 2018-09-07 10:04:57 -07:00
Michał Muskała d76f150274 Use scoped deterministic counters in AST expansion
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-08-04 12:56:01 +02:00
José Valim f2415dd06c Revert "Use deterministic counters in AST expansion"
Unfortunately it is common to have macros that invokes macros
from other modules, leading to mixed quoted expressions causing
the counters to be mixed.

We would need to scope the counters to the caller.

This reverts commit f04f46c49d.
2018-08-04 12:29:03 +02:00
Michał Muskała ffb931a5ac Fix all compiler warnings (#7992) 2018-07-27 16:42:24 +02:00
Fernando Tapia Rico 6d0f78d3bd Validate @on_load function in Elixir (#7973) 2018-07-26 16:57:35 +02:00
Michał Muskała f04f46c49d Use deterministic counters in AST expansion
When the module is being compiled, we use deterministic counters instead
of random ones. This should help with most cases of undeterministic
source code or .beam files.

Closes #7955
2018-07-25 00:10:02 +02:00
Fernando Tapia Rico ae15d1822f Check duplicated @on_load attributes (#7921) 2018-07-18 19:34:31 +02:00
José Valim 54cb02c240 Rely on Erlang/OTP normalization which is faster 2018-07-12 13:28:58 +02:00
José Valim 94f3d60a26 Hard deprecate previously deprecated APIs 2018-07-12 12:44:03 +02:00
José Valim d33bac539c Allow :deprecated to be given as doc metadata 2018-07-11 11:01:57 +02:00
José Valim 32450a0fd9 Remove Code.get_docs/2 and streamline the new chunk generation 2018-07-05 10:31:23 +02:00
Glauber Campinho 4bc3527134 Consider if definition should be checked for @impl
Fixes #7617

Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-05-10 23:05:40 +02:00
José Valim e28931fdaa Pass tracker destination forward to dynamicly defined modules 2018-05-02 12:18:50 +02:00
José Valim 49132ad6c1 Avoid race conditions with code evaluated in after_load callbacks 2018-03-31 10:08:53 +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
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
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
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
José Valim 054f9172fa Do not track @since attributes while bootstraping 2018-01-20 19:46:43 +01:00
José Valim 219c6cc867 Move unused_vars check to Elixir land
This gives us better control over when and how unused variables are printed.

As a result, we are able to emit unused variable warnings in situations
we could not before. This also opens up the way for us to remove a
dependency on erl_lint and track types information, which allows us to
speed up compilation times about 5% and allow us to emit more performant
code in some situations.
2018-01-20 19:45:48 +01:00
José Valim 113d2c69c9 Remove export_vars from Macro.Env 2018-01-20 19:42:08 +01:00
José Valim 9e1485f29a Start v1.7 2017-12-23 19:40:30 +01:00
Glauber Campinho 1d58413053 Introduce @deprecated (#7113) 2017-12-19 11:44:35 +01:00
José Valim 4d3cbcdaaa Introduce @since as non-warning definition annotation
Partially implements #7099.
2017-12-11 18:22:08 +01:00
José Valim 74f617399f Use a single table instead of digraph for tracking locals
This reduces the number of spawned ETS tables from 3 to 1
per local tracker and also removes the need for a separate
process.

Closes #7091.
2017-12-06 19:49:54 +01:00
José Valim 4f935aa942 Add Kernel.ParallelCompiler.async/1
This gives developers more control over the parallel compiler
and allows a single file to compile multiple modules in parallel
by spawning tasks.
2017-11-02 17:30:32 +01:00
José Valim 73ab6b8ead Do not pass :in_memory to load_binary
Erlang's typespecs define only cover_compiled and preloaded
as valid atoms and uses an empty list for generated code.
So we should follow Erlang's rules until we can officially
relax them.
2017-10-14 23:19:32 +02:00
José Valim db95576520 Remove ordering issue on errors_test.exs, closes #6490 2017-08-21 22:17:43 +02:00
José Valim 579f93bcc7 Ensure elixir_erl:debug_info/4 does not require elixir running (#6401) 2017-07-29 17:27:05 +02:00
José Valim a1397e30f2 Do not serialize references, closes #6393 2017-07-29 12:59:18 +02:00
José Valim 1cc84f20c7 Do not use named ETS tables during module definition
Tables named after modules are very likely to be used
the application itself, which can lead to conflicts in
scenarios such as code reloading.

Closes #6361
2017-07-19 23:22:25 +02:00
José Valim 4d244d0df8 ETS table names are not quotable on OTP 20 2017-06-29 12:50:17 +02:00
José Valim 8518652dec Cache the AST on definitions
This speeds up the compilation time from 10% to 15%
measured across different projects.
2017-06-29 10:53:14 +02:00
Michał Muskała 170019c869 Make sure System.stracktrace is first thing done in the handler (#6119)
If any of the functions catches an error, we'd get a wrong trace
2017-05-18 12:27:17 +02:00
Sam Davies 23b94e7eff Do not warn about missing @impl for overridable functions (#6098) 2017-05-11 19:49:01 +02:00
José Valim 92e5d04113 Make sure @impl warns even when @impl is first-used later 2017-05-09 16:26:59 +02:00
Sam Davies d6aa8cc57c Implement @impl directive
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2017-05-09 16:26:59 +02:00
José Valim 8c1ed8de53 Use the new debug_info option on OTP 20 2017-05-08 19:59:57 +02:00
José Valim a95800bc03 Do not include typespecs on module map
They include the environment which would make
storing them very expensive.
2017-05-08 17:56:16 +02:00
José Valim cf7380f360 Build a metadata module for the compiler 2017-05-08 16:30:25 +02:00
José Valim 99b8d36945 Read compiler option directly from the function that uses it 2017-04-22 13:18:36 +02:00
José Valim d1daf3ed40 Support custom backends (undocumented behaviour for now) 2017-02-23 14:27:17 +01:00
José Valim 50e6487879 Move beam building to elixir_erl 2017-02-23 13:42:41 +01:00