Commit Graph
9616 Commits
Author SHA1 Message Date
sabiwara 0a26aa543b Tokenizer uses static_atoms_encoder on quoted keyword keys (#11313)
Closes #11312
2021-10-15 08:10:18 +02:00
José Valim a8b72c759a Group Unicode upcase/downcase by prefix (#11310)
The patch computes byte lookups based on the prefix. For example,
Á, É, etc all have the same prefix <<195>>, so they are lumped
together for lookup and then we just do a byte lookup later. We
tried doing the byte lookup on 64-element tuple (since the byte
is always within 0b10000000 and 0b10111111) but that's slower,
especially because we need to check the byte range for invalid
Unicode, so instead the last byte lookup is a case. Grouping the
top-level lookup makes the cost of a miss 3x cheaper albeit a
hit is 10% more expensive and reduces bytecode size.
2021-10-14 14:44:13 +02:00
Eksperimental 9b80f8a40b Upgrade Unicode database to v14.0.0 (#11308)
Closes #11288.
2021-10-12 18:05:10 +02:00
José Valim 1769e36453 Also mention pattern matching on hint 2021-10-10 19:21:06 +02:00
José Valim 95e985b8aa Simplify with Macro.operator?/2 2021-10-10 11:23:50 +02:00
José Valim 2e7e941321 List ..// under Macro.operator?/2 2021-10-09 12:40:18 +02:00
Seth Archer Brown 8337adb3d2 Fix infinite loop in String.slice/2 (#11302) 2021-10-07 08:12:17 +02:00
José Valim 693446b795 Handle optional_applications field in .app (#11301) 2021-10-06 22:18:59 +02:00
José Valim f05ac0a9a4 Improve docs and remove unnecessary field 2021-10-06 21:28:07 +02:00
Qqwy / Wiebe-Marten 44eff84044 Fix docs of Module.safe_concat/1 / Module.safe_concat/2: (#11299)
- Remove mention of handling charlist (which it does not).
- Also mention in the docs of `Module.concat/1` / `Module.concat/2` that
  this handles both binaries and atoms.
2021-10-06 11:57:00 +02:00
Qqwy / Wiebe-Marten 3afdf4df0d Add a snippet to the docs of defoverridable/1 (#11293)
About that changing the visibility of the function is allowed.

Closes #11292.
2021-10-05 22:31:10 +02:00
José Valim 8133fcf3cd Do not escape metadata in unquote with dynamic expression 2021-10-05 12:21:50 +02:00
felipe stival 2379591575 Always show step when range is descending (#11290) 2021-10-04 13:20:36 +02:00
José Valim e1dc87a558 Add function_exported? fallback to year_of_era 2021-10-04 10:43:09 +02:00
José Valim 843c409ffe Add missing @impl true annotation 2021-10-04 10:38:04 +02:00
José Valim 65741dff1e Keep year_of_era/1 and year_of_era/3 separate 2021-10-04 10:32:59 +02:00
Kip Cole bee316b96f Change Calendar.year_of_era/1 callback to /3 (#11285)
In order to support calendars which can change
era any time during the calendar year, the callback
Calendar.year_of_era/1 is changed to Calendar.year_of_era/3.

Since Calendar.ISO.year_of_era/1 is a public function,
default arguments for month and day are set if
year_of_era/1 is called to allow compatibility with
any existing code that relies upon this function.
2021-10-04 09:09:13 +02:00
José Valim ae51aad8f3 Focus on the public API defined by defstruct, closes #11286 2021-10-03 18:36:48 +02:00
Luiz Rodrigo de Souza c6a1841add Add import Mod, only: :sigils (#11284) 2021-10-03 18:31:10 +02:00
Danila Poyarkov 51ddee7b85 Allow sigil modifiers to contain digits (#11283) 2021-10-02 22:10:05 +02:00
José Valim 186e8629bd Reduce copy of MFAs and values on Task.async* functions
Task.Supervisor.async/* would copy the MFA to the supervisor
process. async_stream/* would additionally copy the value to
the stream coordinator. This commit makes it so those copies
are no longer necessary. The only unnecessary copy is in
Task.Supervisor.start_child/2 which we can't address due to
backwards compatibility.
2021-10-01 23:36:58 +02:00
José Valim 440fa8e997 Add task ignore 2021-10-01 23:36:58 +02:00
Trevor Brown d18b9d4fa9 Correct return type in Regex.scan/3 function spec (#11278)
This function can return a list of tuples containing two integers when
the `return: :index` option is provided.
2021-10-01 07:59:35 +02:00
José Valim b4d3a2ba68 Clarify mixing quotes in location: :keep 2021-09-28 15:04:35 +02:00
Thanabodee Charoenpiriyakij d5ccd5f36b Fix IO.chardata_to_string/1 misleading signature (#11273) 2021-09-27 18:15:44 +02:00
Kip Cole 7003dbfded Update documentation for apply/3 (#11269) 2021-09-23 12:13:24 +02:00
Łukasz Jan Niemier 24707db6ed fix(elixir/List): Better errors when arguments reordered (#11271)
Earlier it was throwing `ArithmeticError` which seems confusing, instead
now it will fail on function clause which should give user better
feedback that the arguments are in wrong order.
2021-09-23 11:38:12 +02:00
Qqwy / Wiebe-Marten 6ffe1d48e4 Changes 'function' to 'macro' in 'sigils' section of Macro moduledocs (#11268) 2021-09-22 10:26:28 +02:00
Oddmund Strømme 152c2abb0e Fix indentation of code example (#11267) 2021-09-22 08:30:25 +02:00
José Valim dd378301c5 Run the formatter 2021-09-21 15:43:09 +02:00
José Valim 46e157abf6 No longer encode missing docs as empty maps in chunk 2021-09-21 15:22:55 +02:00
José Valim 14813215a1 Reduce memory usage when applying flat_map to an enum
Benchee.run(
      %{
        "flatten" => fn ->
          Enum.map(1..100_000, fn x -> List.duplicate(x, 1000) end) |> List.flatten()
        end,
        "flat_map" => fn -> Enum.flat_map(1..100_000, fn x -> List.duplicate(x, 1000) end) end,
        "new" => fn -> New.flat_map(1..100_000, fn x -> List.duplicate(x, 1000) end) end
      }, memory_time: 5
    )

Results:

    Operating System: macOS
    CPU Information: Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Number of Available Cores: 8
    Available memory: 16 GB
    Elixir 1.13.0-dev
    Erlang 24.0

    Benchmark suite executing with the following configuration:
    warmup: 2 s
    time: 5 s
    memory time: 5 s
    parallel: 1
    inputs: none specified
    Estimated total run time: 36 s

    Benchmarking flat_map...
    Benchmarking flatten...
    Benchmarking new...

    Name               ips        average  deviation         median         99th %
    new              0.119         8.43 s     ±0.00%         8.43 s         8.43 s
    flat_map         0.117         8.55 s     ±0.00%         8.55 s         8.55 s
    flatten         0.0952        10.50 s     ±0.00%        10.50 s        10.50 s

    Comparison:
    new              0.119
    flat_map         0.117 - 1.01x slower +0.125 s
    flatten         0.0952 - 1.25x slower +2.07 s

    Memory usage statistics:

    Name        Memory usage
    new              2.98 GB
    flat_map         4.47 GB - 1.50x memory usage +1.49 GB
    flatten          2.98 GB - 1.00x memory usage +0.00150 GB
2021-09-20 09:42:22 +02:00
José Valim 5cca930097 Annotate code to be removed on Erlang/OTP 24 2021-09-19 20:22:30 +02:00
José Valim 70d524ae02 Ensure protocol consolidation metadata is deterministic, closes #11249 2021-09-19 19:56:42 +02:00
José Valim a4e7a95e8b Also mark 0 line annotations as generated 2021-09-18 13:08:25 +02:00
Sergei Maximov 9f3039f423 Fix docs for new functions in Macro.Env (#11259) 2021-09-17 16:04:05 +02:00
José Valim 5df96dbe9f Clarify conflict vs merging in config, closes #11258 2021-09-17 10:40:00 +02:00
Michał Łępicki 6daf9f8a27 Fix Version.Requirement.new/2 spec (#11257)
Some other changes in this module allowed dialyzer to detect and point out spec issues
2021-09-17 09:19:46 +02:00
José Valim d73860ccb0 Ensure proper precedence of and/or in version requirements (#11238) 2021-09-16 10:40:31 +02:00
Quinn Wilton 7711eefe52 Set inspect_fun to the default when building the error message
This improves unclear errors that result in the case where a
custom protocol is passed as the inspect_fun option, and that
protocol is not implemented for some of the types being inspected.

Missing struct implementations are a pathological case here, because
when trying to inspect them as maps, a seemingly unrelated error
message about a missing atom implementation will be reported, while
trying to inspect the value of the :__struct__ field
2021-09-15 12:36:58 +02:00
José Valim 8dfeca1421 Use Mix.Tasks.Format behaviour in tests and doc fixes 2021-09-15 09:45:45 +02:00
José Valim dd4ef1ab0e Support plugins in the formatter 2021-09-15 09:45:45 +02:00
José Valim 504b7b1b50 Allow custom sigil formatting on Code.format_string! 2021-09-15 09:45:45 +02:00
José Valim 7a9a00d9e2 Add power operator (#11241) 2021-09-14 11:08:34 +02:00
Michał Łępicki e32b3314e0 Do not depend on :maps module internals in Map.{filter, reject, map} (#11243)
Closes #11242
2021-09-13 11:18:44 +02:00
Wei Huang 2275215988 Use a b instead of n for Integer.extended_gcd (#11240)
a and b matches the documentation and this also makes the heading in
doc to be `def extended_gcd(a, b)` instead of `def extended_gcd(n, n)`.
2021-09-12 22:34:43 +02:00
Qqwy / Wiebe-Marten 6e04a672fb Implement {Map,Keyword}.{filter,map}/2 (#11239) 2021-09-12 08:53:49 +02:00
José Valim 2a3dfa7d7e Pass annotation forward when building Erlang AST 2021-09-11 10:21:31 +02:00
Christian Wesselhoeft 6c6fa23831 Kernel.tap/2: Explicitly ignore return value for compatibility with Dialyzer unmatched_returns (#11236)
When the `unmatched_returns` option of Dialyzer is enabled, functions
which can return more than a single value must be explicitly matched
against. This fixes `Kernel.tap/2` to be compatible with that option.
2021-09-11 07:49:43 +02:00
José Valim 86619b3709 Also handle nfd at the beginning of strings 2021-09-06 23:00:06 +02:00