Commit Graph
3425 Commits
Author SHA1 Message Date
Fernando Tapia Rico 25c61e39b4 Use default args in Calendar.ISO.*_to_string/* (#8707) 2019-01-26 09:21:34 +01:00
José Valim 0ccf798fc2 Fix rounding for subnormal floats (#8687)
Closes #8685
2019-01-25 08:39:41 +01:00
Eksperimental 5bd907d126 Use hexadecimal notation in code points in tokenizer error msg (#8669) 2019-01-22 13:39:40 +01:00
Eksperimental 3beaf09dfe Correct arity in List test (#8670) 2019-01-22 08:58:37 +01:00
Eksperimental e81f8c065c Simplify guards in List.ascii_printable?/2 (#8656) 2019-01-22 08:50:48 +01:00
Wojtek Mach 736a1ac906 Update Module.spec_to_callback to keep existing specs and copy docs (#8663) 2019-01-21 19:49:44 +01:00
Eksperimental f1eca78ca4 Improve docs in Module functions and raise errors (#8635) 2019-01-21 18:12:51 +01:00
Eksperimental 6fceb8caaa Add test to List.ascii_printable?/2 (#8655)
Add test that checks improper lists with limit
2019-01-20 19:23:09 +01:00
Roman Smirnov 4bdc4e4050 Fix parsing Markdown links for h function (fix #8629) (#8641) 2019-01-16 22:39:14 +01:00
Eksperimental 0da99435c3 Use ID and not id (#8639)
The command used to detect these entries:
ag -s "\b(?<![/:{_\[.])ids?(?![}:_\]])(?!\(\))(?!enti)(?!ea)(?!iom)(?!x)"  --elixir
2019-01-16 19:14:39 +01:00
José Valim a6e9de56db Allow __MODULE__.Something in a nested defmodule
Defining __MODULE__.Something in a nested defmodule would fail
to compile. This commit address this:

    defmodule Foo do
      defmodule __MODULE__.Bar do
        __MODULE__ == Elixir.Foo.Bar
      end
    end

Since `__MODULE__` expands to a fully qualified name `Elixir.Foo`,
the nested module must then be `Elixir.Foo.Bar`. This commit also
fixes an alias leakage that would happen under such scenarios.

Another possible interpretation would be for it to return `Foo.Foo.Bar`.
However, that would mean we would not be able to access the module
right below its definition using `__MODULE__.Bar`, which means its
`Foo.Foo.Bar` would be the incorrect choice.
2019-01-14 23:58:37 +01:00
José Valim 085cb22352 Only perform behaviour checking if blaming 2019-01-13 13:29:52 +01:00
José Valim d7d49e1f58 Consistently forbid upcasting in calendar conversion functions 2019-01-12 09:47:55 +01:00
Bryan Paxton 61a12f4a53 Improve coverage of Version.Parser (#8607)
Added assertions to exists test to cover lines 409, 412, and 511
2019-01-09 13:13:44 +01:00
José Valim 427c2aa3ec Revamp Elixir CLI (#8595)
This commit adds 6 new options to elixir CLI to aid releases:

  * `--pipe-to PIPEDIR LOGDIR` - invokes run_erl with daemon pipe and logs (only on Unix-like systems)

  * `--rpc-eval NODE COMMAND` - evaluates the given expression on the given node

  * `--boot FILE`, `--boot-var VAR VALUE`, `--erl-config FILE` and `--vm-args FILE` - which are equivalent to Erlang's `-boot`, `-boot_var`, `-config` and `-args_file`

We have also rewritten the CLI to only pass Elixir options to Kernel.CLI.
2019-01-08 20:44:43 +01:00
Petr Stepchenko 01fd5a53f3 Add File.rename!/2 (#8606) 2019-01-08 20:25:03 +01:00
José Valim 3e673ac134 Ensure we support counters in bitstring size vars 2019-01-07 22:31:31 +01:00
Fernando Tapia Rico b2c698d295 Provide better errors with invalid dates in Calendar.ISO (#8601) 2019-01-07 21:58:31 +01:00
Fernando Tapia Rico 144e0427c7 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:02:49 +01:00
Fernando Tapia Rico 7ad213b289 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.
2019-01-05 17:46:33 +01:00
José Valim a356e60d45 Refactor Kernel.CLI tests and fix faulty assertions 2019-01-05 13:18:28 +01:00
José Valim 9a87eb5f98 Add System.restart/0 and System.pid/0 (#8597) 2019-01-05 13:17:59 +01:00
José Valim 091886d176 Handle unquote in remote call, closes #8588 2019-01-05 09:17:23 +01:00
Wojtek Mach ca40d1594c Show docs for callback with multiple clauses (#8553)
* Merge callback's multiple clauses in elixir_erl.erl
* Simpler callbacks deduplication
2019-01-02 13:12:01 +01:00
Bruce Park 8aeeb86dfe Improve Protocol.UndefinedError message... (#8579)
when passing the module name of a struct

Addresses https://github.com/elixir-lang/elixir/issues/8532
2019-01-02 13:08:37 +01:00
José Valim b5f6e8e4b2 Default to required map keys
This aligns the behaviour with atoms keys and maps
for state without forcing everyone to pick one or
the other.

For clarity, developers can always use required/optional.
2018-12-27 17:14:21 +01:00
nico piderman a15b07a283 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.
2018-12-27 17:06:13 +01:00
José Valim ad4a363232 Swap argument order to avoid failures on OTP master 2018-12-22 10:04:28 +01:00
José Valim 0c1df34645 Standardize more TODOs 2018-12-21 13:42:54 +01:00
Fernando Tapia Rico 450261295f Deprecate %{key => value} in typespecs (#8537)
%{required(foo) => bar} and %{optional(foo) => bar} should be used.
2018-12-21 12:55:57 +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
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
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
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
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
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 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
eksperimental 9950587f19 Add List.improper?/1 2018-12-08 10:13:39 +01:00
Eksperimental ec61cdbf0b Replace calls to :lists module in files outside lib/elixir (#8467) 2018-12-08 08:30:44 +01:00
Xavier Noria 23259a2f1e Add Range.disjoint?/2 (#8458) 2018-12-06 13:50:49 +01:00
José Valim b8a09a5c4d Add week_of_year/3 (#8460) 2018-12-04 23:18:50 +01:00
Kip Cole edd2c6f780 Add Calendar callbacks and Calendar.ISO implementations
* day_of_year/3
  * quarter_of_year/3
  * year_of_era/1
  * day_of_era/3

Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-12-04 12:28:58 +01:00