Commit Graph
3595 Commits
Author SHA1 Message Date
Eric Meadows-Jönsson a3fc4b3f9e Add variable version to expanded meta (#9520) 2019-11-13 12:57:21 +01:00
José Valim 08d6fe8cb8 Add parens to static remote nullary calls
test/erlang/module_test.erl have also been removed
as they have been ported elsewhere.
2019-11-08 17:59:08 +01:00
Tomasz Marek Sulima 7ae8a96702 Fix for default leftover in Enum.chunk/3 (#9507)
Closes #9506.
2019-11-08 14:51:30 +01:00
Eksperimental 73eb15dd07 Improvements to Calendar docs, specs and guards (#9493) 2019-11-08 14:40:43 +01:00
José Valim c87b6307cd Traverse args of remote functions when looking for undefined/deprecation warnings 2019-11-08 14:32:30 +01:00
José Valim b423b9e2b9 Ensure reassigned variables are properly carried forward 2019-11-06 19:00:36 +01:00
Lau Taarnskov 7a6e421054 Add NaiveDateTime.local_now (#9472) 2019-11-04 22:51:20 +01:00
José Valim 37d0931fd1 Improve error messages on keywords, closes #9467 2019-11-04 14:51:39 +01:00
José Valim c33baba3a8 Add Kernel.is_map_key/2 2019-11-04 12:47:26 +01:00
Eksperimental ed005ea3a1 is_struct/1 fixes (#9481)
* Remove duplicate test

* Simplify name of private function in is_struct/1 test script
2019-11-03 19:07:07 +01:00
José Valim 3d0a56ec9a Improve coverage for non-integers in split/drop/take 2019-11-03 17:30:01 +01:00
Łukasz Jan Niemier 1cee776f3a Add is_struct/1 to Kernel (#9470) 2019-11-03 17:22:33 +01:00
José Valim 64a9fec64b Also handle parens in binary patterns 2019-11-02 18:02:30 +01:00
José Valim 0a0c4fb5e2 Handle binaries without specifiers 2019-11-02 17:28:58 +01:00
José Valim 97b167885b Avoid multiple passes on binary specifier 2019-11-02 16:38:53 +01:00
Glauber Campinho a829084bb8 Raise error on functions/guards without implementation (#9461)
Fixes #9392.

When a local bodiless function is called the generated Erlang code is invalid, this commit checks for bodiless locals during the compilation and raises an error on that avoiding the invalid code.
2019-10-31 07:00:43 -05:00
José Valim 4702c0f809 Also validate types on remote types on self, closes #9460 2019-10-31 10:44:17 +01:00
Wojtek Mach c36cd3e572 Warn if duplicate key is found in record (#9457) 2019-10-30 10:20:56 +01:00
José Valim 4992622be1 Remove a need to merge unused vars 2019-10-29 17:17:53 +01:00
Gary Rennie 711fa0d296 Warn if duplicate key is found in struct (#9452)
Warning is the preferable solution for this, if we raise instead then it
is likely that there are some existing libraries that use duplicate
struct keys that will break.
2019-10-28 20:01:31 -05:00
José Valim cab9c8bc4e Speed up map intersperse for lists 2019-10-28 22:12:06 +01:00
HUANG Wei 898002ec55 Introduce Enum.map_intersperse (#9454)
Fixes #9451
2019-10-28 21:41:14 +01:00
José Valim 325f3e8a62 Load IO opts only if file is empty 2019-10-26 22:17:54 +02:00
Michał 378f47d496 Fix reading whole file opened as :charlist (#9448)
Also make :io.getopts for StringIO consistent with other devices.
2019-10-26 22:09:13 +02:00
José Valim 26ab0248c0 Allow a sorting function on min/max/min_by/max_by (#9427) 2019-10-24 12:51:31 +02:00
José Valim 9eeaf6cbcc Add asc/desc and compare support to Enum.sort (#9432) 2019-10-24 00:05:19 +02:00
José Valim 7e398d5c64 Validate bind_quoted, closes #9406 2019-10-21 21:08:02 +02:00
José Valim 8667a268a4 Improve errors for calls on aliases 2019-10-21 21:02:00 +02:00
José Valim 5428765734 Add tests for spawn_opt being passed downstream and fix Supervisor spec 2019-10-21 19:10:21 +02:00
Hiroaki Osawa b5f2db2966 Add Enum.frequencies/1 and Enum.frequencies_by/2 (#9425) 2019-10-19 06:29:48 -05:00
Eric Meadows-Jönsson 02001d23d3 Add ++ to pattern inference (#9420)
* Add ++ to pattern inference

* Unknown types in list should return list(dynamic())
2019-10-17 15:16:04 +02:00
Eric Meadows-Jönsson 1455083fcb Support counter for var context (#9419) 2019-10-16 17:33:22 +02:00
Cade Ward 542d86edec Add guard to String.replace/4 for better error messages (#9398) 2019-10-16 16:22:20 +02:00
José Valim ccb59d09a2 Mark match? catch-all clause as generated, closes #9411 2019-10-15 10:24:38 +02:00
Fernando Tapia Rico 2954d8b0ac Raise when passing an empty list instead of clauses (#9402)
This fixes an edge case in which the compiler will process an
empty list value (`[]`) as a block with no clauses, which is not
possible.

Here is an example:

    with {:ok, value} <- Map.fetch(%{a: 1}, :a) do
      value
    else
      []
    end

With this change, the code above will not compile.
2019-10-13 16:50:05 +02:00
José Valim b9456a120e Consider options when running regexes on the fly
Closes #9343.
2019-10-11 17:44:23 +02:00
Eric Meadows-Jönsson 03e0a5dd5b Run checker on Code.require_file/1 (#9393)
Closes #9362.
2019-10-10 23:11:10 +02:00
José Valim 929c6359c6 Ensure compilation works for a variable named super, closes #9390 2019-10-09 19:11:04 +02:00
Eric Meadows-Jönsson f51f7fef7c Use elixir_expand to simplify guard tests (#9388) 2019-10-08 19:25:57 +02:00
Eric Meadows-Jönsson 279b481a03 Check more guard functions (#9386) 2019-10-08 04:02:20 +02:00
José Valim 3dc19e2d17 Add defmodule tracing event 2019-10-07 16:12:52 -03:00
José Valim 13ac928fc9 Allow custom calendar representations in calendar sigils (#9367)
For this functionality to work, parse_time|date|naive_datetime|utc_datetime
were added to the Calendar behaviour.
2019-10-01 08:21:13 -03:00
fieldinrain 7f325078a1 Fix defstruct code formatting with inline comments (#9358) 2019-09-26 17:43:41 -05:00
José Valim 897c43ee1c Revert "Add inspect/2 callback to Calendar (#9128)"
This reverts commit 91aea1cc32.
2019-09-24 12:01:52 +02:00
José Valim 658e234811 Speed up getting one random element from enumerables
For lists, we use `length`. This means we need to traverse
the list twice but that is considerably faster than traversing
the list once and invoking `:rand.uniform` per element.

We also inline the code for `take_random(enumerable, 1)` to
avoid generating garbage via tuple operations.
2019-09-20 09:15:13 +02:00
Wojtek Mach 8e40a172c9 Update on_definition with Module.exists?/2 docs & test (#9352) 2019-09-17 10:09:58 +02:00
pete gamache 78b744a967 Warn on trailing commas in word list (#9314) 2019-09-10 08:58:05 -06:00
José Valim 338ba06b59 Add struct keys to tracing on struct expansion 2019-09-01 09:52:18 -06:00
José Valim 45f8b72302 Ensure keyword replace and update preserve order, closes #9315 2019-08-25 12:31:07 +02:00
José Valim 89070e3079 Raise multiple args errors in case with guards, closes #9311 2019-08-23 10:06:21 +02:00