Commit Graph
4619 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 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
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
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
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
José Valim 09c602d10e Properly parse quoted identifiers in function calls 2024-06-05 12:03:56 +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
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
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
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
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 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
José Valim e29af5ac43 Avoid double tracing on captures 2024-05-25 10:47:57 +02:00
José Valim 25e6ce4271 Add pending deprecations 2024-05-24 13:11:29 +02:00
José Valim 582c4f304d Simplify use_stdio and remove output in test 2024-05-24 11:57:47 +02:00
kristofka 4e478b3752 Correctly Macro.escape :quote triplet without meta (#13594)
Closes #13593.
2024-05-24 11:33:03 +02:00
Antoine Bolvy 9651afab1e Add support for use_stdio option to System.shell and Mix.Shell.cmd (#13580) 2024-05-24 11:32:30 +02:00
José Valim 18db5220ce Check for exclamation marks on Windows (#13166)
Closes #13165.
2024-05-24 09:13:22 +02:00
José Valim 03d412f20e Handle bind_quoted with context correctly, closes #13590 2024-05-23 17:36:36 +02:00
José Valim 41cf575ec8 Hoist dynamic up on map creation (#13579) 2024-05-21 13:18:12 +02:00
José Valim 37d36f8bd6 Do not expand bind_quoted expressions twice 2024-05-20 18:01:02 +02:00
José Valim 92e0e34a1e Respect line property when file is given, closes #13542 2024-05-20 17:10:11 +02:00
José Valim a4429ac239 Do not crash on imports inside nested quotes, closes #13575 2024-05-20 13:13:07 +02:00
José Valim f9263fdc54 Do not crash on invalid imports metadata 2024-05-20 12:44:37 +02:00
José Valim 5f2f626a05 Do not raise on Macro.Env.expand_import, closes #13573 2024-05-20 10:55:18 +02:00
Łukasz Samson 64d6d3d345 Fix typo in meta key name in elixir_quote (#13570)
It seems the bug has been introduced in df64d5c6a1 (and 169595f534) where `import` meta has been renamed to `imports` but some places were missed
This bug was present since 1.14.0
2024-05-18 10:38:31 +02:00
Jean Klingler d11b41f65a Revert alias shadowing warning due to false positives (#13568)
* Revert "Fix false positive with nested shadowed alias (#13564)"

This reverts commit 8dc94db457.

* Revert "Warn on unused shadowed aliases (#13550)"

This reverts commit d1b3063050.
2024-05-18 17:00:13 +09:00
Bryan Paxton 496cb2c892 Add support for sigils containing integers (#13448) 2024-05-17 12:40:02 +02:00
Jean Klingler 8dc94db457 Fix false positive with nested shadowed alias (#13564) 2024-05-17 08:13:19 +09:00
José Valim d7ea2fa2e4 Handle cursor completion inside fn/rescue/catch/else/after 2024-05-14 17:04:57 +02:00