Commit Graph
7930 Commits
Author SHA1 Message Date
Fernando Tapia Rico 9ef89241ed Handle non-printable args in StringIO gracefully (#8600)
Non-printable arguments were killing the StringIO process, which
was killing the Logger handler associated to it. That was
causing some errors when users were running their test suites
with `capture_log: true`, because the proxy (Logger handler) was
not there when ExUnit.CaptureLog was trying to remove it.
2019-01-06 21:03:08 +01:00
Fernando Tapia Rico 49351886cf Error on undefined variables in bitstring segments (#8598)
Binary/bitstring matching allows to dynamically define the
`size` of the binary in certain conditions:

  * if the `size` variable is defined prior to the pattern
    match:

        iex> size = 8
        iex> <<a::size(size), rest::binary>> = "hello"
        iex> a
        104

  * if the `size` variable is matched within the same
    binary/bitstring match, prior to its use:

        iex> <<name_size::size(8), name::binary-size(name_size), _rest::binary>> = <<5, "Frank the Walrus">>
        iex> name
        "Frank"

Other cases are considered illegal patterns, for example:

    {name_size, <<name::binary-size(name_size), _rest::binary>>} = {5, "Frank the Walrus"}

This commit raises a `CompileError: undefined variable ...` for such cases.

Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2019-01-05 17:47:13 +01:00
José Valim 9c7edf3117 Handle unquote in remote call, closes #8588 2019-01-05 09:17:45 +01:00
nico piderman 5e715aa16e User defined types with the name record fail to compile in 1.8.0-rc.0 (#8569)
Closes https://github.com/elixir-lang/elixir/issues/8564

This is my first attempt to contribute code to elixir, so please forgive me if this PR is completely naive.

Besides adding the `is_list/1` guards, I have updated the error message to specify that record specifications must use an atom `literal` as the name, to make it clear that the type `atom` is also not valid.


Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2019-01-02 20:22:43 +01:00
José Valim 9b54efb9dd Move Calendar to its group 2019-01-02 16:03:34 +01:00
José Valim 82182818cb More docs to child specs 2019-01-02 16:02:23 +01:00
Jon Anderson 53f16f5a82 Add additional guards for Keywords.merge/3 (#8574) 2019-01-02 16:02:16 +01:00
Wojtek Mach 906df8c981 Make KeyError.message/2 private (#8573)
It was introduced accidentally in #7803 (no docs, no specs)
2018-12-29 11:09:36 +01:00
Eksperimental 04717e4c19 Add missing deprecation related to mix compile.erlang (#8577) 2018-12-29 11:09:24 +01:00
José Valim a3e313b582 Improve docs for supervised proceesses 2018-12-27 23:03:34 +01:00
José Valim b932a52d55 Avoid race conditions on behaviour checks, closes #8568 2018-12-27 16:28:30 +01:00
José Valim 8d269932a6 Streamline supervisor docs
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-12-27 14:54:23 +01:00
José Valim 35e7c8c38c Swap argument order to avoid failures on OTP master 2018-12-22 10:05:21 +01:00
José Valim 8e4d718b93 Provide a quick introduction to OptionParser in mdocs 2018-12-22 00:36:10 +01:00
Eksperimental 3ad9193b4b Add Supported Erlang/OTP versions for v1.8 (#8549) 2018-12-21 17:58:31 +01:00
Wojtek Mach d655a2884e Improve defprotocol/2 docs (#8548)
* `__protocol__` doesn't accept `:name`
* Elaborate on atoms that `__protocol__` accepts
* Change code example to doctest and fix it

Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-12-21 17:44:07 +01:00
José Valim 5529c5fa4e Prepare for v1.8 release 2018-12-21 13:12:42 +01:00
José Valim 2d139352bb Fix cond scope and improve coverage, closes #8542 (#8544) 2018-12-21 12:54:04 +01:00
José Valim 5ce4b61991 Add :reduce to for comprehensions (#8531) 2018-12-21 12:51:28 +01:00
Sergio Espeja 7634f3f4c9 Minor doc changes in Collectable protocol moduledoc (#8543)
In the example, add the type the protocol is implemented for (`MapSet`).
2018-12-20 20:43:36 +01:00
José Valim d48207555a Move regexes guard up for better error messages, closes #8538 2018-12-18 11:31:14 +01:00
Fernando Tapia Rico da561ca876 Raise compile errors on bad record types
The record name must be an atom.

These checks were previously performed by erl_lint.
2018-12-18 00:21:00 +01:00
Fernando Tapia Rico f702f932a2 Raise compile errors on bad binary types
Both size and unit must be non-negative integers.

These checks were previously performed by erl_lint.
2018-12-18 00:21:00 +01:00
Fernando Tapia Rico b3f59d9f9c Raise compile errors on bad range types
Both sides of the range must be integers (after expansion), and
the "first" value must be greater than the "last" value.

These checks were previously performed by erl_lint.
2018-12-18 00:21:00 +01:00
José Valim 24ff3df592 Remove week_of_year
We are uncertain this is the best API to expose this
information. Maybe it is best to expose this as a separate
calendar. That uses the week-based year and week-based
month in the Date/Time structs.
2018-12-17 10:21:35 +01:00
shayne fb97713bce Add missing typespecs to Macro.underscore/1 (#8536) 2018-12-17 09:43:19 +01:00
José Valim 3f6dd0b321 No longer wrap expression in binary as Erlang/OTP 20+ does it by default (#8530) 2018-12-16 20:23:24 +01:00
José Valim ec2e092fdd Add no_spawn_compiler_process option to previous OTP releases
Because Elixir may be compiled with Erlang/OTP 20
to run on Erlang/OTP 22.
2018-12-15 23:20:26 +01:00
Eksperimental 93ceb95e76 Simplify custom links when linking to Kernel and SpecialForms (#8528)
Now that ExDoc automatically links to functions in
Kernel and Kernel.SpecialForms, when linking to them in custom links,
we can leave out the module name.
2018-12-15 08:44:27 +01:00
Dennis Beatty f244ee310f add hint for behaviours on UndefinedFunctionErrors (#8517)
This is the first pass on #8513. I would love any feedback you have on this.
2018-12-14 17:21:27 +01:00
Eksperimental bd37919247 Improvements to Operators guide (#8512) 2018-12-14 09:58:43 +01:00
Fernando Tapia Rico 31e177d0aa Minor doc changes in the Protocol.consolidate/2 (#8518)
[ci skip]
2018-12-13 14:26:33 +01:00
José Valim bb5a66698c Raise for capture outside of function, closes #8516 2018-12-13 11:20:18 +01:00
José Valim 55ead12b0a Move record warning to warning test file 2018-12-11 19:50:22 +01:00
José Valim 95934e56c4 Add $callers tracking to Task (#8510)
This allows us to track which process invoked the Task
besides its ancestors in the supervision tree.

Closes #7995
2018-12-11 19:05:53 +01:00
Eksperimental 51187a3acb Touch-ups to String.jaro_distance/2 (#8506) 2018-12-11 19:05:41 +01:00
Eksperimental f43d9095e9 Replace quotation marks (#8505)
Replaces "’" U+2019 RIGHT SINGLE QUOTATION MARK with
"'" U+0027 APOSTROPHE.

Replaces “ (U+201C LEFT DOUBLE QUOTATION MARK)
with " (U+0022 QUOTATION MARK).
2018-12-11 15:19:06 +01:00
eksperimental 4e7c652db3 Replace en-dash with regular hypen
Replace en-dash "–" (U+2013 EN DASH) with regular hyphen "-" (U+002D HYPHEN-MINUS).
While correct, it is reported in  #4408 that it will not display correctly em-dashes in
Windows terminals.
README file is updated accordingly for consistency.

While https://en.wikipedia.org/wiki/Jaro–Winkler_distance uses an en-dash,
it is replaced to avoid the problem in Windows terminals, since Wikipedia
takes care of the redirection.
2018-12-11 14:42:29 +01:00
Eksperimental 886f871afb Fix day in t:File.erlang_time (#8503)
Bug recently introduced in 499446737e
2018-12-11 13:16:28 +01:00
Michał Muskała f7935d9351 Make sure records use the dsetelement optimisation (#8062)
Closes #8059

Additionally some more refactorings of the Record module
2018-12-11 12:44:02 +01:00
Eksperimental d5c5e7eb5f Revamp List.ascii_printable?/2 (#8491)
- Simplify logic
- Add specs
- Validate specs with guards, raising on non-lists
- Add tests
- Correct documentation about improper lists
- Rename argument `counter` to `limit`
2018-12-11 11:53:15 +01:00
Peter Saxton 94252f7f63 Clarify scope of => operator in documentation (#8465) 2018-12-11 11:46:46 +01:00
Wojtek Mach 9e3903e293 Fix typo in File docs (#8500) 2018-12-11 11:45:51 +01:00
José Valim 499446737e Allow posix time on touch and document proper defaults
This fixes issue #8450 which was caused by the user of
`system_time` when `os_time` should have been used.

This commit improves the touch API by also allowing
posix times in `File.touch/2` and also document its
defaults. With this change, we phase out the remaining
use of Erlang's `:calendar` module in Elixir.
2018-12-11 10:31:37 +01:00
Eksperimental ca1bc6c3da IO.ANSI.Docs: Make regex in escape_underlines_in_link/1 handle all schemes (#8497)
It follows the same rules as URI.parse/1

Related to #8494
2018-12-10 09:48:37 +01:00
Eksperimental f55ce7c39e Simplify regex in URI.parse/1 (#8498)
It removes the unnecessary escaping.
2018-12-10 09:29:32 +01:00
Eksperimental f2d1b4209b ascii -> ASCII (#8499) 2018-12-10 09:24:34 +01:00
HUANG Wei a6139bc2c0 Stricter link check in IO.ANSI.Docs module (#8494)
Closes #8449
2018-12-09 18:06:25 +01:00
Devon Estes 5378cf21ef Inline type definition for easier navigation (#8478)
This means we don't force users to go to erlang.org
to know what they really mean.
2018-12-09 08:49:13 +01:00
Eksperimental 1c03026d80 Elaborate on which characters are considered printable in charlists (#8492) 2018-12-09 08:44:15 +01:00