Commit Graph
11265 Commits
Author SHA1 Message Date
Jean Klingler 1c17f1eed3 Fix bug when using pinned variable in with else block (#13667) 2024-06-15 18:49:17 +09:00
José Valim 1e0559e9ed Clarify charlists intro, closes #13663 2024-06-14 17:34:16 +02:00
José Valim c911466bbb Provide references on structs for more information, closes #13664 2024-06-14 17:31:22 +02:00
José Valim 8c5c421b58 Avoid compiling some values twice when building .beam 2024-06-14 09:06:56 +02:00
Jean Klingler d25845c9d5 Fix dialyzer error when with else clause is calling a no_return function (#13659)
Close #13656
2024-06-13 21:33:36 +09:00
Ben Murden 5945fb6fb4 Minor grammatical fixes on warning message (#13654) 2024-06-13 08:36:16 +02:00
José Valim 252d4faef7 Clarify typespecs handling 2024-06-11 21:14:11 +02:00
Philip Sampaio ac933f71f6 Add PowerShell scripts (#13592)
The idea is to provide them as alternative to bat scripts and potentially
replace all bat scripts in the future. One benefit of using PowerShell is
that we can also run it on Linux systems, facilitating dev and testing.
2024-06-11 12:17:36 +02:00
José Valim ce92b1cbb3 s/detail/details 2024-06-10 22:38:15 +02:00
Maksym Verbovyi 9a06273ad2 Correct example in the docs (#13638) 2024-06-10 16:37:57 +02:00
Lukasz Samson f3c3d3dde6 Fix crash when capturing ambiguous import 2024-06-10 16:37:10 +02:00
José Valim 7a4060cbf3 Add detail and span to typing diagnostics
Closes #13646.
2024-06-10 16:13:39 +02:00
Andrea Leopardi d5095f64d2 Add a missing dash to Process.sleep/1 docs 2024-06-10 10:19:14 +02:00
José Valim c69938bae7 Use :dot_iex as the option name consistently 2024-06-09 23:28:31 +02:00
Vsevolog Grigoriev f484960800 Handle arbitrarily high integer values in Process.sleep/1 (#13649)
Aligns Process.sleep/1 behaviour with OTP :timer.sleep/1 function.
https://www.erlang.org/doc/apps/stdlib/timer.html#sleep/1
2024-06-09 18:20:02 +02:00
Jean Klingler 8ca99ab24d Revert types from #13552 (#13645) 2024-06-06 23:01:53 +09:00
Jean Klingler cabd7d8506 Add more information to anonymous rescue hint (#13641) 2024-06-06 21:15:11 +09:00
Theodor Fiedler 67b8b6c218 Extend Duration shift documentation (#13640) 2024-06-06 00:04:20 +02:00
José Valim 21840ed563 Do not assume all parser errors can be parsed into erlang terms 2024-06-05 12:21:23 +02:00
José Valim 09c602d10e Properly parse quoted identifiers in function calls 2024-06-05 12:03:56 +02:00
José Valim ad1ac3b783 Use a different name for the registry 2024-06-05 11:33:04 +02:00
Steffen Deusch 844c4c30de use a :queue to store modules in ExUnit.Server (#13636)
In order to have more deterministic test runs when using `--max-cases 1`
and `--max-requires 1` (https://github.com/elixir-lang/elixir/pull/13635)
(see also https://github.com/elixir-lang/elixir/pull/13589), we need to
run tests in compilation order (FIFO).

In the past, ExUnit.Server appended new tests to the front of a list,
which would result in the most recently added test to be run first.

Let's quickly demonstrate the problem this causes for deterministic runs
with a simple example:

Imagine a test (let's call if FooTest) that takes a non-deterministic
amount of time to run. For now let's assume that it sometimes takes 1
second and sometimes up to 5. And as async tests execute in parallel with
compilation of other test files, we could have the following scenario:

FooTest is compiled and because it's async it is immediately started.
It takes 1 second to run.
In this 1 second two more tests are compiled. First BarTest is prepended
to the list, then BazTest.
The order of test runs now is:

FooTest, BazTest, then whatever is last compiled while BazTest runs, ...

Now another run, FooTest takes 5 seconds to run.
While FooTest runs, more than two other tests are compiled.
The order of test runs is:

FooTest, LastCompiledTest, SecondLastCompiledTest, ..., BazTest, BarTest

This can be fixed either by appending new test modules to the end of the
list, or - and that's what this commit does - by using a `:queue`
instead.
2024-06-05 11:21:07 +02:00
José Valim d6e6924c89 Purge modules between tests 2024-06-05 11:20:27 +02:00
Steffen Deusch c28a4eb040 Add max_concurrency to Kernel.ParallelCompiler (#13634) 2024-06-04 16:04:15 +02:00
José Valim b50d986631 Use __info__ callback directly (#13630) 2024-06-02 16:17:02 +02:00
José Valim 11aa0fc526 Optimize :term (#13625) 2024-06-02 14:58:57 +02:00
liamwhite ae60fa6bd5 Document bare decimal case on String.to_float/1 and Float.parse/1 (#13629) 2024-06-02 14:58:00 +02:00
Łukasz Samson 29bb5116d1 Allow to override the info callback in Macro.Env.define_import (#13628) 2024-06-02 14:02:33 +02:00
José Valim 478256b59e Avoid discarding information on conversion to #elixir_ex 2024-06-01 17:58:01 +02:00
José Valim 60f6515c24 Avoid nesting of capture inside macros
Unfortunately this makes it so the unused capture
warnings emit false positives, so this particular
warning was removed.

Closes #13609.
2024-06-01 17:08:18 +02:00
José Valim 7de811cfd5 Fix warnings and races in tests 2024-05-31 22:37:05 +02:00
José Valim ff26a8fac6 Deprecate Module.eval_quoted in favor of Code.eval_quote 2024-05-30 21:07:03 +02:00
José Valim b56ed82fe3 Type check the function type on fun.() 2024-05-30 20:37:37 +02:00
José Valim a52133fdf0 Remove more checks that can now be performed by the type system 2024-05-30 20:37:37 +02:00
Daniel Kukula ed67d6be18 implement dbg for code blocks (#13619) 2024-05-30 11:02:01 +02:00
Jean Klingler 91feadd479 Implement dbg for unless/2 expressions (#13620) 2024-05-30 15:46:57 +09:00
Jean Klingler c2c4cade84 Replace statement -> expression when relevant (#13621) 2024-05-30 15:46:40 +09:00
José Valim 8dabe63030 Reorganize testing structure 2024-05-29 22:22:33 +02:00
José Valim b665ddd6db Add parameterized tests (#13618)
Sometimes you want to run the same tests but with different parameters.
In ExUnit, it is possible to do so by passing a `:parameterize` key to
`ExUnit.Case`. The value must be a list of maps which will be the
parameters merged into the test context.

For example, Elixir has a module called `Registry`, which can have type
`:unique` or `:duplicate`, and can control its concurrency factor using
the `:partitions` option. If you have a number of tests that *behave the
same* across all of those values, you can parameterize those tests with:

    use ExUnit.Case,
      async: true,
      parameterize:
        for(kind <- [:unique, :duplicate],
            partitions <- [1, 8],
            do: %{kind: kind, partitions: partitions})

Then, in your tests, you can access the parameters as part of the context:

    test "starts a registry", %{kind: kind, partitions: partitions} do
      ...
    end

Use parameterized tests with care:

  * Although parameterized tests run concurrently when `async: true` is also given,
    abuse of parameterized tests may make your test suite slower

  * If you use parameterized tests and then find yourself adding conditionals
    in your tests to deal with different parameters, then parameterized tests
    may be the wrong solution to your problem. Consider creating separated
    tests and sharing logic between them using regular functions
2024-05-29 15:44:16 +02:00
Daniel KukulaandJean Klingler 7cf57ec815 Implement dbg/2 for "if" expressions (#13603)
Co-authored-by: Jean Klingler <sabiwara@gmail.com>
2024-05-29 08:30:00 +02:00
José Valim 967c87b9d3 Simplify iso conversion, prefer Duration.new! 2024-05-29 00:05:48 +02:00
Tangui fcc7ea20ef Implement Duration.to_iso8601/1 (#13604) 2024-05-28 23:52:17 +02:00
Theodor Fiedler 29fb214f14 Support plus sign prefix in Calendar.ISO.parse_duration/1 (#13613) 2024-05-28 21:12:47 +02:00
Theodor Fiedler 420a939f1b Support negative period prefix in Calendar.ISO.parse_duration/1 (#13608) 2024-05-27 23:05:41 +02:00
Łukasz Samson 642cc79bb7 Keep position meta on & capture special variables in expanded AST (#13607) 2024-05-27 21:31:04 +02:00
Theodor Fiedler ae5be3106f Add Duration.from_iso8601/1 (#13473) 2024-05-27 11:47:38 +02:00
José Valim 47079bc0b2 Add more deprecations scheduled to v1.18 2024-05-26 21:44:10 +02:00
José Valim 19406b1f55 Add Keyword.intersect/2-3 2024-05-26 10:58:54 +02:00
José Valim 1b6c31a0eb Avoid the number of duplicate traces on imports 2024-05-25 11:10:22 +02:00
José Valim 1508494761 Remove assert_no_clauses check as we already handle -> 2024-05-25 10:55:42 +02:00