Commit Graph
3643 Commits
Author SHA1 Message Date
José Valim 0fdc7510b8 Remove guard checks on is_odd/is_even as those are tested in defguard, closes #9700 2020-01-12 16:00:12 +01:00
Eric Meadows-Jönsson 0e8873238d Do not warn for functions generated by Erlang compiler (#9713) 2020-01-12 15:42:54 +01:00
Eric Meadows-Jönsson ba02eb90a0 Allow any type on the RHS of or/2 (#9706)
Closes #9704.
2020-01-11 12:19:29 +01:00
Eric Meadows-Jönsson fdc7716bf3 Improve type check error message (#9705)
A type error may not always cause a clause to fail.

Related to #9700.
2020-01-11 12:19:29 +01:00
José Valim a050c00fbc Use meta on rewrites, closes #9714 2020-01-11 12:17:43 +01:00
Dmitry Kakurin 033c7387e2 Fix Path.absname/1 to correctly handle UNC paths on Windows (#9689) 2020-01-06 22:50:47 +01:00
Eric Meadows-Jönsson a72a388e1c Remove type inversion (#9695) 2020-01-06 20:05:17 +01:00
Wojtek Mach a256c5578e Add option :all to :no_warn_undefined (#9691) 2020-01-06 00:01:52 +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
Sascha Wolf f0fbf0241a IO.ANSI.Docs - Properly render quote blocks (#9684) 2020-01-05 15:54:24 +01:00
José Valim 6760cdbf14 Run the formatter 2020-01-04 12:52:45 +01:00
José Valim 5dd271d361 Fix bounded funs in macrocallbacks, closes #9687 2020-01-03 17:18:27 +01:00
José Valim 7f86ea3334 Allow reboot to be disabled in releases, closes #9552 2019-12-30 14:06:05 +01:00
José Valim 203d540c3a Fixes for new Macro.to_string behaviour 2019-12-24 11:57:02 +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 00abb3b6e3 Allow positive range slices on infinite streams
Closes #9653.
Closes #9654.
2019-12-24 11:17:23 +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 46f6ba563b Allow nested cycles, closes #9652 2019-12-16 10:32:19 +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
Eric Meadows-Jönsson 40799f2688 Preserve slashes in URIs without authority (#9632)
Old behavior:

    to_string(URI.parse("file:///path")) == "file:/path"

New behavior:

    to_string(URI.parse("file:///path")) == "file:///path"
2019-12-06 16:34:13 +01:00
Jan Hruban e1b14cad05 Close with correct accumulator in Stream.resource/3 (#9627)
In the optimized case with a single-element list returned from the
`next_fun`, call the stream function chain in a separate try/catch
block. If it errors out, call the `after_fun` with the new accumulator
returned from `next_fun`.

Previously the `after_fun` was called with the old accumulator in such
case.
2019-12-06 14:44:25 +01:00
José Valim d2ac69eafa Ensure children are trapping exits before terminating 2019-12-04 12:33:01 +01:00
José Valim 917ad8ff2e Fix race conditions in impl test 2019-12-04 12:24:24 +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
Eksperimental b82ad0a512 Allows heading separator in IO.ANSI.Docs to not to have spaces around "|" (#9616)
This is supported by GFM (GitHub Flavored Markdown).
2019-12-03 10:01:02 +01:00
Eksperimental 7312b40458 Fix bug when last two columns are empty in IO.ANSI.Docs (#9615)
When this happened, the last "|" became the content of the second to
last column.

This happened for example with the table in the Base module

    ## Base 64 (URL and filename safe) alphabet
    ...
    12 | M | 29 | d | 46 | u | 63    | _
    13 | N | 30 | e | 47 | v | |     |
    14 | O | 31 | f | 48 | w | (pad) | =
    15 | P | 32 | g | 49 | x | |     |
    16 | Q | 33 | h | 50 | y | |     |
2019-12-01 09:10:45 +01:00
Josh Price 9938ff428d Replace exsplus with exrop as the OTP 20 default pseudorandom algorithm (#9609) 2019-11-28 18:32:15 +01:00
Samuel Pordeus 2ed9f6e006 Fix typo on test name (#9611) 2019-11-28 18:03:05 +01:00
José Valim 14fde590a8 Raise if a non-absolute path is given with host or authority (#9589) 2019-11-23 20:46:23 +01:00
José Valim 5d773d9978 Fix race condition on dynamic supervisor test, closes #9574 2019-11-21 18:15:49 +01:00
José Valim aa7f19718c Return {:error, :unavalable} for ensure_compiled in a deadlock (#9543) 2019-11-19 09:12:40 +01:00
Eksperimental b0d4288174 Use titlecase in Elixir, Erlang, EEx, Unicode, and Dialyzer (#9557) 2019-11-19 09:10:29 +01:00
Eksperimental 98daa2def1 Use argument instead of arg in error messages (#9561) 2019-11-19 09:09:10 +01:00
José Valim ac4548f7cc Deprecate Code.ensure_compiled?/1
There are many implications behind using Code.ensure_compiled?/1,
so we do not want to hide it behind a simple boolean check.
Instead use `Code.ensure_compiled/1` which is clearer about intent
and on return values.
2019-11-17 18:47:31 +01:00
Josh Price 5d57c91174 Make the number of attempted function clauses in FunctionClauseError more obvious (#9544) 2019-11-17 15:19:05 +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 e1f347b75a Add async: true to tests using capture_io :stderr 2019-11-15 10:00:16 +01:00
Fernando Tapia Rico 739de75187 Exclude tests that require epmd on Windows (#9533)
Temporary disable those test on Windows since the empd daemon is
failing to start in some Windows setups.
2019-11-14 09:32:13 +01:00
Fernando Tapia Rico 1bfebe66a3 Prevent calling non-async functions in async tests (#9455)
Capturing a named device other than `:stdio`, such as `:stderr`,
happens globally and requires `async: false`.
2019-11-14 08:11:02 +01:00
Eric Meadows-Jönsson d0a3fdbfd7 Use reverse rewrite in checker 2019-11-14 00:16:01 +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 16730b59c0 Make unification directed
This is to support subtype unification with source and target types for expression checking. Pattern checking is bidirectional, meaning it always picks the subtype, we do this by flipping the source and target on unification failures.

We can also simplify trace collection by removing the variable inference stack.
2019-11-13 16:42:25 +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