Commit Graph
1925 Commits
Author SHA1 Message Date
Eksperimental 83ec6e3614 Use argument instead of arg in error messages (#9561) 2019-11-19 09:09:10 +01:00
José Valim dbf8a7a9fe Use version metadata in Erlang pass 2019-11-16 02:45:55 +01:00
Eric Meadows-Jönsson 623a91936b Track variable version globally (#9536)
Instead of incrementing the version for each variable individually we increment it globally for all variables. This means we can uniquely identify each variable assignment with only the version.
2019-11-15 17:18:39 +01:00
José Valim 19157377cc Add patterns information to guards page 2019-11-14 12:33:53 +01:00
Eric Meadows-Jönsson 9587134429 Change Bitwise macros to rewrites 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson 8ece599b6d Add reverse rewrite and inline rules 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson d2df63470f Move unification to Infer module 2019-11-13 16:42:25 +01:00
Eric Meadows-Jönsson 4ae121700a Split Infer into Expr and Pattern modules 2019-11-13 16:42:25 +01:00
Eric Meadows-Jönsson a3fc4b3f9e Add variable version to expanded meta (#9520) 2019-11-13 12:57:21 +01:00
José Valim 08d6fe8cb8 Add parens to static remote nullary calls
test/erlang/module_test.erl have also been removed
as they have been ported elsewhere.
2019-11-08 17:59:08 +01:00
José Valim b423b9e2b9 Ensure reassigned variables are properly carried forward 2019-11-06 19:00:36 +01:00
José Valim 37d0931fd1 Improve error messages on keywords, closes #9467 2019-11-04 14:51:39 +01:00
José Valim c33baba3a8 Add Kernel.is_map_key/2 2019-11-04 12:47:26 +01:00
José Valim fe2f36877a Simplify emission of rescue clauses to avoid duplicate generation 2019-11-03 16:44:49 +01:00
José Valim 345403c05d Refactor Erlang try code 2019-11-03 16:22:20 +01:00
José Valim 5944706239 No need to track stacktrace usage 2019-11-03 13:56:39 +01:00
José Valim 7648c0f3a8 elif to else 2019-11-03 13:06:30 +01:00
Łukasz Jan Niemier 9fca33e09f Cleanup TODOs for OTP 21+ (#9477) 2019-11-03 13:05:18 +01:00
José Valim 43daa41c11 Remove redundant rewrite as it has been optimized in the VM 2019-11-02 17:12:27 +01:00
José Valim cf881389cf Remove unecessary Erlang macro 2019-11-01 19:19:54 +01:00
Łukasz Jan Niemier f128ae3d7a Use Erlang's logger as main logging implementation (#9333) 2019-11-01 15:53:05 +01:00
Glauber Campinho c363d7e4d0 Avoid second calculation of arity in expand_local/4 (#9463) 2019-10-31 20:49:23 +01:00
Glauber Campinho a829084bb8 Raise error on functions/guards without implementation (#9461)
Fixes #9392.

When a local bodiless function is called the generated Erlang code is invalid, this commit checks for bodiless locals during the compilation and raises an error on that avoiding the invalid code.
2019-10-31 07:00:43 -05:00
José Valim a932e8abf2 Bootstrap typespec before code 2019-10-29 20:42:24 +01:00
José Valim 978024023c Use maps:merge on Erlang pass 2019-10-29 19:37:21 +01:00
José Valim cbbaa1e6e8 Apply mergev optmization on erlang pass 2019-10-29 19:37:12 +01:00
José Valim 30607b8a54 Remove unecessary mergev on elixir_erl 2019-10-29 18:20:34 +01:00
José Valim c74bfa4a52 Only transform environment in match if necessary 2019-10-29 17:17:53 +01:00
José Valim 1c9b55ae6d Further optimize variable merging 2019-10-29 17:17:53 +01:00
José Valim acc9b49208 Move unused_vars to its own variable 2019-10-29 17:17:53 +01:00
José Valim 4992622be1 Remove a need to merge unused vars 2019-10-29 17:17:53 +01:00
José Valim 0a5ce41cb5 Simplify scoped merge of unused vars 2019-10-29 17:17:53 +01:00
José Valim dc3387bf84 Remove need for mergev on match/head 2019-10-29 17:17:53 +01:00
Glauber Campinho 688b1c6cc8 Execute callbacks on :elixir_compiler after all warnings are emitted (#9447)
Currently the callbacks on :elixir_compiler are called before the warnings of unused aliases and imports are emitted, causing the messages to not consumed during the compilation. This commit changes `:elixir_lexical.run/2` to `:elixir_lexical.run/3` splitting the callback in two, one during the execution to evaluate the forms and another to be called after all the warnings are emitted.

Fixes #9440
2019-10-26 10:58:28 +02:00
José Valim 2493ff907d Remove unused funtionality and erase pdict properly 2019-10-25 15:29:46 +02:00
José Valim 7e398d5c64 Validate bind_quoted, closes #9406 2019-10-21 21:08:02 +02:00
José Valim 8667a268a4 Improve errors for calls on aliases 2019-10-21 21:02:00 +02:00
Fernando Tapia Rico bb07e717e4 Remove redundant guard
Kudos to @michalmuskala
2019-10-14 11:57:51 +02:00
Fernando Tapia Rico 2954d8b0ac Raise when passing an empty list instead of clauses (#9402)
This fixes an edge case in which the compiler will process an
empty list value (`[]`) as a block with no clauses, which is not
possible.

Here is an example:

    with {:ok, value} <- Map.fetch(%{a: 1}, :a) do
      value
    else
      []
    end

With this change, the code above will not compile.
2019-10-13 16:50:05 +02:00
Eric Meadows-Jönsson 03e0a5dd5b Run checker on Code.require_file/1 (#9393)
Closes #9362.
2019-10-10 23:11:10 +02:00
José Valim 929c6359c6 Ensure compilation works for a variable named super, closes #9390 2019-10-09 19:11:04 +02:00
Eric Meadows-Jönsson 2026d48780 Move map.ex to bootstrap (#9389) 2019-10-08 14:39:05 +02:00
José Valim 3dc19e2d17 Add defmodule tracing event 2019-10-07 16:12:52 -03:00
Björn Gustavsson 68a4d96546 Optimize elixir_tokenizer (#9347)
When comparing characters in `elixir_tokenizer`, replace `==` and `/=`
with the more efficient `=:=` and `=/=` operators.

The `=:=` and `=/=` operators are more efficient because they can
only return `true` if the operands have the same type:

    1> $* =:= 42.
    true
    2> $* =:= 42.0.
    false

In contrast, the `==` operator can return `true` when comparing
an integer and a float:

    3> $* == 42.0.
    true

Using `=:=` and `=/=` also gives the Erlang compiler more opportunites
for optimization. For example, when compiling the `is_sigil` macro,
the compiler can combine all eight comparisons into a single `select_val`
instruction instead of emitting eight separate instructions.
2019-09-14 12:42:07 +02:00
José Valim 338ba06b59 Add struct keys to tracing on struct expansion 2019-09-01 09:52:18 -06:00
José Valim 89070e3079 Raise multiple args errors in case with guards, closes #9311 2019-08-23 10:06:21 +02:00
Eric Meadows-Jönsson 475076adfd Support struct patterns (#9306) 2019-08-22 13:28:05 -07:00
Eric Meadows-Jönsson 4ccf1e1e64 Split Module.Types and add unit tests (#9303) 2019-08-20 11:46:13 -07:00
José Valim 329d9b8475 Warn when function head comes immediately after the implementation 2019-08-15 19:23:38 +02:00
José Valim db4cb93ae3 Use an empty keyword list instead of nil for empty definitions 2019-08-14 14:51:49 +02:00