Commit Graph
3425 Commits
Author SHA1 Message Date
Fernando Tapia Rico 11eb44c3f8 Use default args in Calendar.ISO.*_to_string/* (#8707) 2019-01-26 09:21:34 +01:00
José Valim d3de9717df Fix rounding for subnormal floats (#8687)
Closes #8685
2019-01-25 08:39:41 +01:00
Eksperimental 0f7cc5ccde Use hexadecimal notation in code points in tokenizer error msg (#8669) 2019-01-22 13:39:40 +01:00
Eksperimental 84b70d226b Correct arity in List test (#8670) 2019-01-22 08:58:37 +01:00
Eksperimental 14f95c0a49 Simplify guards in List.ascii_printable?/2 (#8656) 2019-01-22 08:50:48 +01:00
Wojtek Mach 22fcd3ff22 Update Module.spec_to_callback to keep existing specs and copy docs (#8663) 2019-01-21 19:49:44 +01:00
Eksperimental cd38956540 Improve docs in Module functions and raise errors (#8635) 2019-01-21 18:12:51 +01:00
Eksperimental 19db82f40d 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 c32c83f251 Fix parsing Markdown links for h function (fix #8629) (#8641) 2019-01-16 22:39:14 +01:00
Eksperimental 60ecf10dc7 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 67f2bc42d7 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 dc98c9a127 Only perform behaviour checking if blaming 2019-01-13 13:29:52 +01:00
José Valim cd3e7ff51d Consistently forbid upcasting in calendar conversion functions 2019-01-12 09:47:55 +01:00
Bryan Paxton 72c127ab9f 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 fdba441757 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 eb423ea51f Add File.rename!/2 (#8606) 2019-01-08 20:25:03 +01:00
José Valim 4c87c902c9 Ensure we support counters in bitstring size vars 2019-01-07 22:31:31 +01:00
Fernando Tapia Rico f898ab4587 Provide better errors with invalid dates in Calendar.ISO (#8601) 2019-01-07 21:58:31 +01:00
Fernando Tapia Rico 2a98543053 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 7104ca20fd 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 7b2f30eb5f Refactor Kernel.CLI tests and fix faulty assertions 2019-01-05 13:18:28 +01:00
José Valim 3b0de65041 Add System.restart/0 and System.pid/0 (#8597) 2019-01-05 13:17:59 +01:00
José Valim 426e39dd80 Handle unquote in remote call, closes #8588 2019-01-05 09:17:23 +01:00
Wojtek Mach 0dc5b9adf2 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 f046675ed1 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 0de3f21794 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 92618574ad 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 f90d32e17d Swap argument order to avoid failures on OTP master 2018-12-22 10:04:28 +01:00
José Valim f93d703979 Standardize more TODOs 2018-12-21 13:42:54 +01:00
Fernando Tapia Rico 2b4a72e217 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 af51f27f39 Fix cond scope and improve coverage, closes #8542 (#8544) 2018-12-21 12:54:04 +01:00
José Valim 07a3be8965 Add :reduce to for comprehensions (#8531) 2018-12-21 12:51:28 +01:00
Fernando Tapia Rico 57023a4816 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 4700d329a3 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 2a78a0afb3 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 02b42cde84 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 87e38d5118 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 364ee2ad85 Move record warning to warning test file 2018-12-11 19:50:22 +01:00
José Valim 8f5adcd27b 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 f1ad6a0771 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 be15686bab 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 e30bb6a795 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 aca28b6c4f 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 f0688b304e ascii -> ASCII (#8499) 2018-12-10 09:24:34 +01:00
HUANG Wei a3bd7e2e16 Stricter link check in IO.ANSI.Docs module (#8494)
Closes #8449
2018-12-09 18:06:25 +01:00
eksperimental c57d1ac379 Add List.improper?/1 2018-12-08 10:13:39 +01:00
Eksperimental cedbf20e2f Replace calls to :lists module in files outside lib/elixir (#8467) 2018-12-08 08:30:44 +01:00
Xavier Noria c34d0f3325 Add Range.disjoint?/2 (#8458) 2018-12-06 13:50:49 +01:00
José Valim adc0be0df9 Add week_of_year/3 (#8460) 2018-12-04 23:18:50 +01:00
Kip Cole 61109400eb 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