Commit Graph
3766 Commits
Author SHA1 Message Date
Eksperimental 512594c08a Mention file:line in Already defined as ... error message (#10219) 2020-07-22 14:59:37 +02:00
José Valim 92cf894756 Require a trailing underscore to consider it a compiler variable 2020-07-17 13:59:52 +02:00
Eric Meadows-Jönsson f80fedde81 Remaining map guards should add optional keys
Closes #10148.
2020-07-16 01:47:17 +02:00
José Valim 6228ade7d2 Do not warn if quotes are used on complex atoms
Atoms that have non-ascii characters or @ does not
require tokens. That's to streamline the developer
experience around examples :"foo@computer-name" and
:"hélló".
2020-07-15 20:10:31 +02:00
José Valim 08706cc490 Warn if a variable that looks like a compiler variable is unused (#10198)
Closes #10197.
2020-07-15 12:20:49 +02:00
Henrik Nyh 41159e562f Remove incorrect arities in test descriptions (#10194)
These tests actually use get_and_update_in/3 and pop_in/2.

I removed the arities, rather than correcting them, since it seems
like unnecessary detail here.
2020-07-15 00:07:04 +02:00
Eksperimental b04089d9b9 Enforce typespec limitation in bitstring unit (#10187) 2020-07-14 08:11:37 +02:00
José Valim d135c7f8ca Add Date.day_of_week/2, beginning_of_week/2, and end_of_week/2 (#10181)
This augments the Calendar behaviour by adding
a new function, c:Calendar.day_of_week/4 which
supports a starting_on value with defaults and
calendar specific semantics.
2020-07-13 12:29:36 +02:00
Wojtek Mach 9f6e39d1b2 Update Date.range/2 to accept t:Calendar.date/0 (#10182) 2020-07-13 11:09:17 +02:00
Tomasz Marek Sulima c192083726 Add is_exception/1 and is_exception/2 guards (#10180) 2020-07-12 13:55:11 +02:00
José Valim b3d6aff7b6 Load config/runtime.exs in escripts 2020-07-11 18:30:46 +02:00
José Valim 7aa93b188c Improve compiler error message when using | in a def pattern 2020-07-11 10:22:28 +02:00
José Valim faec14746f Add config_target() 2020-07-08 17:06:10 +02:00
José Valim b2270699e1 Add config_env() and allow imports to be disabled in config files
Also used new functionality throughout Mix, including releases,
which will now prefer to load a config/runtime.exs file over
config/releases.exs.
2020-07-06 21:09:02 +02:00
Eric Meadows-Jönsson 801f52fc5d is_map_key/2 should add optional keys (#10156)
Closes #10148.
2020-07-06 17:14:30 +02:00
Eksperimental b792ae50c3 Display file:line in already defined type error message (#10145) 2020-07-03 08:32:51 +02:00
Eric Meadows-Jönsson 1b7c4c3944 Improve map warnings (#10142) 2020-07-02 16:14:01 +02:00
José Valim 2ccef8c503 Avoid more escaping on Windows 2020-07-01 15:51:48 +02:00
José Valim 8895603c21 Improve coverage for types that look like built-in types, closes #10140 2020-07-01 15:18:49 +02:00
José Valim a948b42e0e Clean up typespec suite 2020-07-01 15:08:18 +02:00
José Valim b4040b99d7 Remove quotes to address escaping on Windows 2020-07-01 13:03:40 +02:00
José Valim 522af0821b Remove spaces from tmp_dir and use it in more places 2020-07-01 11:47:09 +02:00
José Valim 4a2047af1f Keep proper precedence in guards generated by in/2, closes #10138 2020-07-01 00:17:16 +02:00
José Valim 739a41f54f Do not use backticks in error messages, simplify field/fun printing (#10139) 2020-06-30 22:35:22 +02:00
Eric Meadows-Jönsson ea885f293c Add map checks (#10136) 2020-06-30 13:26:52 +02:00
José Valim a00178092e Raise if lists have more than 1023 elements in guards
Closes #10114
2020-06-29 15:13:28 +02:00
Wojtek Mach e935cf0784 Add :tmp_dir tag to ExUnit (#10135) 2020-06-29 13:51:07 +02:00
José Valim 72adfa330d Normalize paths before expanding them (#10132)
Closes #9896
2020-06-28 14:29:50 +02:00
Eric Meadows-Jönsson e6e5d2a98d Add Version test for pre-release fields
If a pre-release field compares lexically or numerically higher then it
does not matter that it may have less fields in total.

Closes #10126.
2020-06-26 12:56:01 +02:00
Michał Muskała aace60b863 Fix bug in Inspect.AlgebraTest (#10128) 2020-06-25 17:03:32 +02:00
José Valim e51cc8b88c Also track exports API via local deps 2020-06-25 15:09:14 +02:00
José Valim 16fafe2117 Fix CI 2020-06-25 13:01:57 +02:00
José Valim 2b2587c68c Include compilation time of individual modules on --profile=time
For example, in Plug, you might see:

    [profile] lib/plug/conn.ex compiled in 935ms
    [profile] lib/plug/ssl.ex compiled in 147ms (plus 744ms waiting)
    [profile] lib/plug/static.ex compiled in 238ms (plus 654ms waiting)
    [profile] lib/plug/csrf_protection.ex compiled in 237ms (plus 790ms waiting)
    [profile] lib/plug/debugger.ex compiled in 719ms (plus 947ms waiting)
    [profile] Finished compilation cycle of 60 modules in 1802ms
    [profile] Finished group pass check of 60 modules in 75ms

This commit also increases the precision of --long-compilation-threshold
which now tracks only the time spent compiling and not the time waiting.
For this reason, we have reduced the threshold time to 10 seconds.
2020-06-25 12:29:59 +02:00
José Valim 9a6db666a1 Do not make requires/imports compile-time dependencies
Previously, imports and requires were always added as
compile-time dependencies. With this change, they are
"export" dependencies, which are dependencies that depend
on the API defined by a module, such as struct and its
public definitions.

This change should drastically remove the amount of
modules recompiled in Elixir, making imports more feasible
for large projects.
2020-06-24 14:30:00 +02:00
José Valim b56c262db3 Only run in interactive mode if there is a config provider
We also don't hardcode the RELEASE_MODE config variable
inside Config.Provider, instead we use the application
environment. To make this possible, we simplify the boot
signature for the provider so it only calls boot/0 instead
of a dynamic app-key pair.
2020-06-14 10:53:26 +02:00
Kelvin Stinghen 83374a88c9 Rewording the default arguments warnings (#10097) 2020-06-13 11:28:09 +02:00
José Valim cc138f37f2 Add line numbers to deprecated imports 2020-06-11 15:59:07 +02:00
José Valim 0df37749af Use reserved word where appropriate instead of token/keyword 2020-06-11 10:34:50 +02:00
Wojtek Mach 3757e36ed7 Don't add compile-time dependency on defdelegate (#10093)
The dependency doesn't seem needed in this case.

We go through extra hoops to maintain dynamic invocations where
`opts` is not a compile-time list and :to is not a literal.

An easy way to see this optimization is:

    defmodule A do
      defdelegate f(), to: B
    end

    defmodule B do
      def f() do
        :ok
      end
    end

    $ touch lib/b.ex && mix compile --verbose
    Compiling 1 file (.ex)
    Compiled lib/b.ex

vs:

    defmodule A do
      opts = [to: B]
      defdelegate f(), opts
    end

    defmodule B do
      def f() do
        :ok
      end
    end

    $ touch lib/b.ex && mix compile --verbose
    Compiling 2 files (.ex)
    Compiled lib/b.ex
    Compiled lib/a.ex
2020-06-11 09:31:12 +02:00
Cleidiano Oliveira 70da709881 Allow user to define a type named union (#10055) 2020-05-23 12:41:17 +02:00
José Valim 44061c8499 Do not crash when checking empty receive 2020-05-22 10:58:12 +02:00
Kip Cole 1f80700c10 Add :nfkd and :nfkc forms to String.normalize/2 (#10046) 2020-05-18 21:08:31 +02:00
Jeroen Visser c12a130e7c Allow a sorting function on Enum.min_max_by/3,4 (#10033)
This should keep backwards compatibility as it relies on the arity of
the sorter to determine if it is a empty_fallback or a sorter.
2020-05-14 12:26:59 +02:00
José Valim f1b0da335e Run the formatter 2020-05-03 11:20:23 +02:00
José Valim f3c4aae804 Improve tests for cond 2020-05-02 14:01:52 +02:00
José Valim 2dacb59d36 Support proper encoding in releases config (#10012) 2020-05-01 20:13:50 +02:00
José Valim bdde9e619b Revert "Add String.titlecase/2 (#10008)"
Unicode says "HH" is not titlecased, which means we need
to downcase the rest of the string, which is the behaviour
we already have in capitalize.

This reverts commit 3be3afb920.
2020-04-30 21:34:25 +02:00
Denis Oblogin 3be3afb920 Add String.titlecase/2 (#10008) 2020-04-30 21:11:02 +02:00
José Valim 8bcbfe9a87 Do not send keyword through static_atoms_encoder, closes #9996 2020-04-29 11:09:05 +02:00
José Valim 8770a61769 Handle ; inside empty parens, closes #9964 2020-04-26 11:42:20 +02:00