Commit Graph
1943 Commits
Author SHA1 Message Date
Eric Meadows-Jönsson 0e8873238d Do not warn for functions generated by Erlang compiler (#9713) 2020-01-12 15:42:54 +01:00
José Valim a050c00fbc Use meta on rewrites, closes #9714 2020-01-11 12:17:43 +01:00
Devon Estes ec65f8d48a Always capture delimiter metadata for sigils (#9671)
This makes it so we're always capturing delimiter metadata for sigils
instead of requiring the `token_metadata` option. This means that we can
now show the correct sigils in ExUnit diffs (and elsewhere) for code
examples.
2020-01-05 16:07:58 +01:00
José Valim 5dd271d361 Fix bounded funs in macrocallbacks, closes #9687 2020-01-03 17:18:27 +01:00
José Valim 3b16807374 Reduce the amount of data sent between compilation processes 2020-01-03 17:18:27 +01:00
José Valim d2c9824ef9 Respect :no_parens meta in nullary remote calls in Macro.to_string
Closes #9668.
2019-12-24 11:41:02 +01:00
José Valim 9e560c7909 Make sure error messages contain all relevant information
We have recently changed the compiler to emit a warning
for each undefined function with a generic error at the
end saying the module could not be defined.

Unfortunately, some tools like IDEs and Phoenix Reloader
give higher priority to errors over warnings, which means
an error would be shown but without any actionable
information.

This commit changes it so the first undefined function is
an error and all following ones are warnings.
2019-12-23 11:47:21 +01:00
Wojtek Mach bdc2e99c29 Improve error message on import/2 (#9663)
Before:

    iex(1)> a = [flatten: 1]; import List, only: a
    ** (CaseClauseError) no case clause matching: {:only, {:a, [version: 0, line: 1], nil}}
        (elixir 1.10.0-dev) src/elixir_import.erl:10: :elixir_import.import/4

After:

    iex(1)> a = [flatten: 1]; import List, only: a
    ** (CompileError) iex:1: invalid :only option for import, expected value to be an atom :functions, :macros, or a list literal, got: a
        (elixir 1.10.0-dev) src/elixir_import.erl:22: :elixir_import.import/4
2019-12-20 08:56:56 +01:00
José Valim 3b3c15b979 Do not add no_warn_undefined to CInf chunk 2019-12-09 10:33:35 +01:00
Eric Meadows-Jönsson 9394612a3d Remove signatures from checker chunk (#9634) 2019-12-07 18:09:50 +01:00
José Valim ba619b1c3e Add Application.compile_env/3 (#9628)
Mix stores the compile_env in each applications' .app file.

Releases and Mix tasks were also changed to validate against
the runtime configuration against any stored `compile_env`.
In case of mismatches, an error is raised during boot.
2019-12-06 17:23:01 +01:00
José Valim 46fa678f42 Refactor elixir_config and mix compilers for upcoming changes 2019-12-04 11:59:51 +01:00
José Valim 60733b8d7c Print all undefined functions as warnings and then raise (#9623)
Sometimes one undefined function warning can hide others.
For example, in a function call like this:

    foo(bar 1, 2)

The user may be expecting it to be called as:

    foo(bar(1), 2)

But Elixir compiles it to:

    foo(bar(1, 2))

In this case, the warning would be one of "undefined
function foo/1" or "undefined function bar/2", but they
are only "half truths". By showing all undefined function
warnings, we improve errors like above and it allows
users to see all undefined calls at once, when it would
otherwise require them to compile the code multiple times.
2019-12-03 10:33:59 +01:00
José Valim 6c0e49f0b7 Add examples to ambiguous op error message 2019-12-02 10:27:28 +01:00
Eksperimental 9d87fe434e Replace usage of "etc." (#9569) 2019-11-29 08:22:18 +01:00
José Valim 7bc73a3d18 Use infinity timeout in internal services 2019-11-27 11:17:09 +01:00
José Valim f6ef422f4c No need to cache home 2019-11-22 19:08:35 +01:00
Eksperimental 2121cbd086 Replace usage of "e.g." (#9571) 2019-11-22 11:26:23 +01:00
Eksperimental 98daa2def1 Use argument instead of arg in error messages (#9561) 2019-11-19 09:09:10 +01:00
José Valim 2b05b8dcf3 Use version metadata in Erlang pass 2019-11-16 02:45:55 +01:00
Eric Meadows-Jönsson b3e48bc1cb 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 d18f707dc9 Add patterns information to guards page 2019-11-14 12:33:53 +01:00
Eric Meadows-Jönsson 1e4e05ef78 Change Bitwise macros to rewrites 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson 5cfaf11478 Add reverse rewrite and inline rules 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson 095a3cc3bd Move unification to Infer module 2019-11-13 16:42:25 +01:00
Eric Meadows-Jönsson 45f29d226f Split Infer into Expr and Pattern modules 2019-11-13 16:42:25 +01:00
Eric Meadows-Jönsson a58b74d1ac Add variable version to expanded meta (#9520) 2019-11-13 12:57:21 +01:00
José Valim 8e7befb108 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 49d865b1a0 Ensure reassigned variables are properly carried forward 2019-11-06 19:00:36 +01:00
José Valim d844c8e6ba Improve error messages on keywords, closes #9467 2019-11-04 14:51:39 +01:00
José Valim 0c8414d739 Add Kernel.is_map_key/2 2019-11-04 12:47:26 +01:00
José Valim 1d7ea39d74 Simplify emission of rescue clauses to avoid duplicate generation 2019-11-03 16:44:49 +01:00
José Valim a6aeeb90e6 Refactor Erlang try code 2019-11-03 16:22:20 +01:00
José Valim ed272a96cb No need to track stacktrace usage 2019-11-03 13:56:39 +01:00
José Valim d5a1cf5107 elif to else 2019-11-03 13:06:30 +01:00
Łukasz Jan Niemier 2c8e75c3d3 Cleanup TODOs for OTP 21+ (#9477) 2019-11-03 13:05:18 +01:00
José Valim 642ae17bc7 Remove redundant rewrite as it has been optimized in the VM 2019-11-02 17:12:27 +01:00
José Valim afa860ab4a Remove unecessary Erlang macro 2019-11-01 19:19:54 +01:00
Łukasz Jan Niemier 67dec4683d Use Erlang's logger as main logging implementation (#9333) 2019-11-01 15:53:05 +01:00
Glauber Campinho 3940206b03 Avoid second calculation of arity in expand_local/4 (#9463) 2019-10-31 20:49:23 +01:00
Glauber Campinho 6f6e45f38a 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 1e583993a9 Bootstrap typespec before code 2019-10-29 20:42:24 +01:00
José Valim 477e588acc Use maps:merge on Erlang pass 2019-10-29 19:37:21 +01:00
José Valim 77ee8afe9a Apply mergev optmization on erlang pass 2019-10-29 19:37:12 +01:00
José Valim 6d8ce83715 Remove unecessary mergev on elixir_erl 2019-10-29 18:20:34 +01:00
José Valim 123eb4e6d2 Only transform environment in match if necessary 2019-10-29 17:17:53 +01:00
José Valim 60a472e1ae Further optimize variable merging 2019-10-29 17:17:53 +01:00
José Valim 9529e528cc Move unused_vars to its own variable 2019-10-29 17:17:53 +01:00
José Valim a3b1ba5a44 Remove a need to merge unused vars 2019-10-29 17:17:53 +01:00
José Valim cf9a833ff9 Simplify scoped merge of unused vars 2019-10-29 17:17:53 +01:00