Commit Graph
8574 Commits
Author SHA1 Message Date
José Valim 8b82564ebd 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
sanposhiho 6073b130ba Add guards to enum index access (#9667) 2019-12-22 19:09:07 +01:00
Wojtek Mach 71cbb6a2c5 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
Evan Travers b216acfc1b "matched pattern" -> "match" (#9662)
We seem to use "pattern" to describe the thing that is doing the
matching, and "match" to describe the _found_ object. This is intended
to make this docs more consistent with the language found in the `Regex`
module.

Fixes #9659
2019-12-19 23:52:07 +01:00
Martin Gausby af67d1c14a Fix spelling mistake in docs (#9660) 2019-12-19 12:09:43 +01:00
José Valim 0fc4174402 Allow nested cycles, closes #9652 2019-12-16 10:32:19 +01:00
Eksperimental 6cb8736c64 Use "code point" instead of "codepoint" (#9649)
That's the term it is used in the Unicode standard.
related commit 266caa2f2f
2019-12-13 18:46:48 +01:00
José Valim 494b7c5fde Clarify call syntax for Keyword, closes #9645 2019-12-13 09:40:51 +01:00
Dmitry Belyaev 510c476564 Replace UTF-8 code point with Unicode code point (#9643) 2019-12-13 09:39:54 +01:00
José Valim f6a4d2f7e3 More improvements to Kernel typespecs 2019-12-12 09:48:08 +01:00
José Valim 8b54fe1fb6 Update kernel.ex 2019-12-12 09:28:30 +01:00
José Valim 6122c6885d Do not add no_warn_undefined to CInf chunk 2019-12-09 10:33:35 +01:00
Eric Meadows-Jönsson a28df2eaec Remove signatures from checker chunk (#9634) 2019-12-07 18:09:50 +01:00
José Valim b2d58e5f35 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 5ca55e5f18 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 865e95f630 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 17ce9a1814 Use .exs extension in config reader input 2019-12-04 16:40:51 +01:00
José Valim 0f059d6afe Ensure children are trapping exits before terminating 2019-12-04 12:33:01 +01:00
José Valim 581797d7f9 Fix race conditions in impl test 2019-12-04 12:24:24 +01:00
José Valim 9f13fc5d4e Refactor elixir_config and mix compilers for upcoming changes 2019-12-04 11:59:51 +01:00
José Valim 7bef4e3095 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 dc84c0cc5c 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
José Valim e66115644a Add examples to ambiguous op error message 2019-12-02 10:27:28 +01:00
Brandon Zylstra 1fb95bb9b7 Grammar suggestions for syntax reference (#9622) 2019-12-02 10:03:35 +01:00
Eksperimental 99c796fb16 Fix table format in Base module (#9614) 2019-12-01 09:11:53 +01:00
Eksperimental 07d5157e88 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
Eksperimental 8eef0ae581 Replace usage of "etc." (#9569) 2019-11-29 08:22:18 +01:00
Josh Price 8e01d36f06 Replace exsplus with exrop as the OTP 20 default pseudorandom algorithm (#9609) 2019-11-28 18:32:15 +01:00
Samuel Pordeus a27c63308d Fix typo on test name (#9611) 2019-11-28 18:03:05 +01:00
José Valim 37e9ddd6e5 Use infinity timeout in internal services 2019-11-27 11:17:09 +01:00
José Valim 052bab0d9e Add deprecation notice to System.get_pid 2019-11-24 15:42:03 +01:00
Andrea Leopardi 1cd473b941 Improve documentation for Config.Provider (#9595) 2019-11-24 10:48:42 +01:00
Yoshihiro Tanaka 5f44dd447e Add missing unreserved character to URI document (#9591)
According to RFC 3986, section 2.3, add missing unreserved character.
The implementation already includes it.
2019-11-24 00:14:17 +01:00
José Valim 67cd1ecb99 Raise if a non-absolute path is given with host or authority (#9589) 2019-11-23 20:46:23 +01:00
Eksperimental 0e3e80a983 Use URI.parse/1 instead of building %URI{} manually whenever possible (#9590) 2019-11-23 19:11:53 +01:00
José Valim c26eaa0bfa Expose an API for returning paths and streamline deprecations 2019-11-22 19:08:35 +01:00
José Valim 47751cf4f1 No need to cache home 2019-11-22 19:08:35 +01:00
Eksperimental e8378b83da Replace usage of "e.g." (#9571) 2019-11-22 11:26:23 +01:00
José Valim a0ce094a30 Make generated app message consistent when building source, closes #9583 2019-11-22 11:25:01 +01:00
José Valim ca5c748892 Fix race condition on dynamic supervisor test, closes #9574 2019-11-21 18:15:49 +01:00
José Valim b795d75a99 Sleep after sending restart command 2019-11-20 21:10:19 +01:00
Piotr Szmielew 8a7f27e61a Add second example for Stream.resource/3 (#9564) 2019-11-20 14:04:31 +01:00
Eksperimental edc17fa73a Style mention to operating systems (#9562)
Use:
- macOS, instead of MacOS X;
- Windows 7, instead of Win7
- Unix, instead of UNIX
- Unix-like operating system or Unix-like system, instead of just Unix
2019-11-19 16:54:07 +01:00
Eksperimental a0303ec0c9 [ci skip] Copyedit deprecations table (#9554) 2019-11-19 16:53:01 +01:00
José Valim 685dd1a3e0 Return {:error, :unavalable} for ensure_compiled in a deadlock (#9543) 2019-11-19 09:12:40 +01:00
Eksperimental 00053dc00f Explicitly mention that def and defmacro define public functions/macros (#9556) 2019-11-19 09:11:16 +01:00
Eksperimental 0acab05f53 Use titlecase in Elixir, Erlang, EEx, Unicode, and Dialyzer (#9557) 2019-11-19 09:10:29 +01:00
Eksperimental 83ec6e3614 Use argument instead of arg in error messages (#9561) 2019-11-19 09:09:10 +01:00
Eksperimental 1d02b882b3 Example in defmodule shows the return value as mentioned in the bulleted list (#9555) 2019-11-19 09:08:14 +01:00
Eksperimental 209b02120c Refer properly to Erlang datetime tuple in the docs (#9560)
[ci skip]
2019-11-19 13:21:07 +05:30