Commit Graph
12376 Commits
Author SHA1 Message Date
Guillaume Duboc 469acb110f Fix guard equality with short-circuit operators
Signed-off-by: José Valim <jose.valim@gmail.com>

Closes #15253.
Closes #15257.
2026-04-11 10:16:59 +02:00
José Valim 7061c37b88 Add --no-compile to mix format
Closes #15256.
2026-04-10 12:19:25 +02:00
Nelson Vides 74bb90a3cd SWAR-optimize ASCII fast paths in String.length and String.slice (#15255)
Add 56-bit SWAR (SIMD Within A Register) acceleration to skip_length/2
and byte_size_remaining_at/2, processing 8 ASCII bytes per iteration
instead of one. Uses the Mycroft zero-byte detection algorithm to
validate that 7+1 bytes are all ASCII with no \r in a single guard.

This mirrors the approach taken in OTP's string module
(OTP https://github.com/erlang/otp/pull/10948).
2026-04-09 23:22:54 +02:00
Lukasz Samson 5d794ab17c Pass correct bitstring meta during expansion
Closes #15244
2026-04-08 18:42:12 +02:00
José Valim 8cc693864a Improve docs for start_link on supervisor and genserver, closes #15232 2026-04-04 11:17:19 +02:00
José Valim 0f8baa3041 Remove test with race condition (already covered in warnings_test.exs) 2026-04-04 11:17:19 +02:00
José Valim 2916f20189 Keep warnings on map/remote dispatch with/without parens
Closes #15219.
2026-03-30 10:27:58 +02:00
Jean Klingler a58a40ce48 Purge and delete modules if after_verify/2 callback fails (#15220) 2026-03-26 20:08:02 +09:00
Eksperimental b77e65dd8a Improve funcion signatures and guard consistency in Module (#15215)
Before function signatures showed arguments as: arg, tuple, tuples.
Now they appear as: definition, definitions.

Guards has been improved and standardized, along with variable names.
2026-03-25 08:19:24 +01:00
José Valim 37bbba9d58 Document map_get behaviour, do not split term types, closes #15209 2026-03-25 08:06:50 +01:00
José Valim 2a7a37f598 Add reverse arrows for min/max, closes #15210 2026-03-25 08:00:32 +01:00
José Valim 972df19e13 Work around compiler bug in Erlang/OTP 27+ 2026-03-24 19:50:31 +01:00
José Valim bafb68db8e Another attempt to work around Erlang/OTP compiler bug 2026-03-24 19:14:50 +01:00
José Valim 24ebb96a27 Expand case by hand to avoid bug in Erlang/OTP 27+ 2026-03-24 19:05:40 +01:00
José Valim 8eb702aea3 Add fast path for two leafs 2026-03-24 18:43:32 +01:00
José Valim 415cd20100 Allow difference formulas to apply across unions 2026-03-24 18:32:33 +01:00
José Valim 5979c42de7 Fix rendering of regex docs 2026-03-24 11:32:51 +01:00
José Valim 5949bad336 Fix pretty printing of map difference 2026-03-23 22:24:00 +01:00
José Valim cfd62cec73 Propagate fields on difference only once, closes #15207 2026-03-23 22:17:50 +01:00
José Valim a9ce579829 Revert structs into export time dependencies 2026-03-23 12:52:50 +01:00
José Valim 8df8f92030 Fix introduction to the next topic in some pages, closes #15205 2026-03-22 20:04:55 +01:00
José Valim e17069e559 Protocol should not add deps on implementations, closes #15202 2026-03-19 10:17:04 +01:00
José Valim 4aa837d255 Remove unused optimization branch in difference 2026-03-18 17:25:08 +01:00
José Valim d8c921fabc Refine hd/tl in guards, closes #15198 2026-03-17 09:36:20 +01:00
José Valim 9c00059f18 Further optimize map differences and fix bug in map_update with negated keys 2026-03-16 23:27:44 +01:00
José Valim 630d5ca629 Fix typos in code comments 2026-03-16 23:27:44 +01:00
Panagiotis Nezis 5bf4df5520 Raise ArgumentError in Keyword.from_keys/2 for non-atom keys (#15197) 2026-03-16 18:30:53 +01:00
José Valim 4064905654 Do not perform structural operations on leaf difference 2026-03-15 17:30:50 +01:00
José Valim 6cb9140d9f Remove unnecessary empty checks when computing previous types 2026-03-15 15:31:19 +01:00
José Valim bffb6965a6 Implement one key difference for leaf bdd difference
This allows us to implement previous as a series of
unions, which performs better across all cases.

Closes #15195.
2026-03-15 15:18:47 +01:00
José Valim c39d9ea762 Add more comments to descr, avoid unnecessary traversals 2026-03-15 13:24:03 +01:00
José Valim 98468bd8e3 Further optimize leaf differences 2026-03-15 12:36:35 +01:00
José Valim c8c7abc3b2 Do not check previous if we know args types and previous are disjoint 2026-03-14 19:33:23 +01:00
José Valim 690323e174 Perform fewer args_to_domain conversions 2026-03-14 19:01:19 +01:00
José Valim 528f8e7d7b Return boolean for is_integer/3 with all integers 2026-03-14 11:17:17 +01:00
José Valim 127901b8f8 Add type signature for :erlang.is_integer/3 2026-03-14 11:16:03 +01:00
José Valim aec5d53284 Optimize tuple_fetch, closes #15154 2026-03-14 11:00:40 +01:00
José Valim 7945446cb4 Allow preserving sigil metadata in container cursor to quoted
Closes #14243.
2026-03-13 20:03:34 +01:00
José Valim 5bad452d0a Show undefined function errors even on variable failure, closes #13465 2026-03-13 17:07:37 +01:00
José Valim ec8156aad9 Tiny cleanup on sigil chapter 2026-03-13 11:53:10 +01:00
Jonatan Kłosko 7967ff985b Add :dbg_callback option to Code eval functions (#15189) 2026-03-13 08:13:01 +01:00
Gonzalo R 4021272d42 Fix missing space typo in compiler error message (#15186) 2026-03-12 21:45:00 +01:00
Philipp 28ffbcfe84 Add nil as documented valid option for GenServer :name (#15187) 2026-03-12 20:37:58 +01:00
José Valim f9310524b1 Revert "Fix unnecessary recompilation when dbg_callback is modified at runtime (#15007)" (#15185)
This reverts commit c80a3b1a0e.
2026-03-12 12:50:48 +01:00
José Valim b18637fb97 Treat modules with --no-debug-info as uncached, closes #15159
Additionally make sure --debug-info is part of the cache key.
2026-03-12 11:12:26 +01:00
José Valim df0553bd08 Do not raise false positive on not is_struct checks, closes #15183 2026-03-12 09:59:54 +01:00
Panagiotis Nezis ababaf8b08 Fix URI.merge leaking :+ marker when base path is empty string (#15179)
When merging URIs where the base has `path: ""`, the internal `:+` marker
used to track the join point between base and relative paths was being
converted to a literal "+" in the output.
2026-03-11 12:07:04 +01:00
Panagiotis Nezis 9b80ab584d Fix admonition blocks in Module docs (#15175) 2026-03-10 17:56:20 +01:00
Guillaume Duboc 51207406d0 Clarify and test gradual function application (#15173)
* Implement gradual function domains and tighten function application

Add fun_domain/1 to compute function domains for static, dynamic, and mixed function types, including explicit :badfun and {:badarity, ...} outcomes when domain extraction is not well-defined.

Refine gradual function application internals by separating static and dynamic normalization paths, documenting behavior for purely dynamic and mixed cases, and clarifying domain/compatibility handling.

Expand descr tests with gradual-application edge cases and a dedicated fun_domain test suite covering static, dynamic, mixed, and arity-error scenarios.

* Refactor function application and domain handling

* Remove fun_domain, recover coverage via fun_apply tests

fun_domain was only used in tests; its behavior is fully observable
through fun_apply (wrong-domain arg → :badarg, right-domain → :ok).
Removed it and converted the domain tests to fun_apply assertions,
adding a few previously uncovered cases along the way: pure non-fun
badfun, union-arg-type enforcement, 2-arity, mixed-arity badarity
for both static and dynamic unions, and the mixed static+dynamic
gradual domain case.

* Remove dead helpers introduced alongside fun_domain

fun_single_arity, fun_single_arity_pair, fun_non_empty_arities_of,
and fun_non_empty_arities are now unreachable. Also revert
dynamic_fun_top? to the simpler map == %{} check — the semantic
emptiness scan added in the refactor was only needed to handle
the same edge cases fun_domain was handling.

* Move mixed-arity badarity check to static side of fun_normalize_both

fun_normalize itself stays simple (no arity cross-check). The check
for other non-empty arities now lives in fun_normalize_both via
fun_other_non_empty_arities/2, and only fires for the static
component. This means:

- union(fun/1, fun/2) applied with 1 arg → {:badarity, [1, 2]}
  (static: we know one branch will always fail at runtime)

- union(dynamic_fun/1, dynamic_fun/2) applied with 1 arg →
  {:ok, dynamic(integer())} (dynamic: picks matching-arity arrows,
  wraps in dynamic() to reflect that the other branch may fail)

* Add tests for mixed-arity union behavior

Static union: badarity regardless of which arity is called with,
with the called arity listed first followed by the others.

Dynamic union: picks the matching-arity arrows and wraps in dynamic(),
gives badarity only when no arity matches at all, and falls back to
dynamic() when the arg is outside the domain but dynamically compatible.
2026-03-10 13:39:54 +01:00
Jean Klingler 78a5151865 Add support for [:raw] opts in File.read (#15172) 2026-03-10 20:07:07 +09:00