Commit Graph
3611 Commits
Author SHA1 Message Date
José Valim aa7f19718c Return {:error, :unavalable} for ensure_compiled in a deadlock (#9543) 2019-11-19 09:12:40 +01:00
Eksperimental b0d4288174 Use titlecase in Elixir, Erlang, EEx, Unicode, and Dialyzer (#9557) 2019-11-19 09:10:29 +01:00
Eksperimental 98daa2def1 Use argument instead of arg in error messages (#9561) 2019-11-19 09:09:10 +01:00
José Valim ac4548f7cc Deprecate Code.ensure_compiled?/1
There are many implications behind using Code.ensure_compiled?/1,
so we do not want to hide it behind a simple boolean check.
Instead use `Code.ensure_compiled/1` which is clearer about intent
and on return values.
2019-11-17 18:47:31 +01:00
Josh Price 5d57c91174 Make the number of attempted function clauses in FunctionClauseError more obvious (#9544) 2019-11-17 15:19:05 +01:00
José Valim 2b05b8dcf3 Use version metadata in Erlang pass 2019-11-16 02:45:55 +01:00
Eric Meadows-Jönsson b3e48bc1cb Track variable version globally (#9536)
Instead of incrementing the version for each variable individually we increment it globally for all variables. This means we can uniquely identify each variable assignment with only the version.
2019-11-15 17:18:39 +01:00
José Valim e1f347b75a Add async: true to tests using capture_io :stderr 2019-11-15 10:00:16 +01:00
Fernando Tapia Rico 739de75187 Exclude tests that require epmd on Windows (#9533)
Temporary disable those test on Windows since the empd daemon is
failing to start in some Windows setups.
2019-11-14 09:32:13 +01:00
Fernando Tapia Rico 1bfebe66a3 Prevent calling non-async functions in async tests (#9455)
Capturing a named device other than `:stdio`, such as `:stderr`,
happens globally and requires `async: false`.
2019-11-14 08:11:02 +01:00
Eric Meadows-Jönsson d0a3fdbfd7 Use reverse rewrite in checker 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson 1e4e05ef78 Change Bitwise macros to rewrites 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson 5cfaf11478 Add reverse rewrite and inline rules 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson 16730b59c0 Make unification directed
This is to support subtype unification with source and target types for expression checking. Pattern checking is bidirectional, meaning it always picks the subtype, we do this by flipping the source and target on unification failures.

We can also simplify trace collection by removing the variable inference stack.
2019-11-13 16:42:25 +01:00
Eric Meadows-Jönsson 095a3cc3bd Move unification to Infer module 2019-11-13 16:42:25 +01:00
Eric Meadows-Jönsson 45f29d226f Split Infer into Expr and Pattern modules 2019-11-13 16:42:25 +01:00
Eric Meadows-Jönsson a58b74d1ac Add variable version to expanded meta (#9520) 2019-11-13 12:57:21 +01:00
José Valim 8e7befb108 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 52f01c22bc Fix for default leftover in Enum.chunk/3 (#9507)
Closes #9506.
2019-11-08 14:51:30 +01:00
Eksperimental 9071853fe8 Improvements to Calendar docs, specs and guards (#9493) 2019-11-08 14:40:43 +01:00
José Valim 5b097ae638 Traverse args of remote functions when looking for undefined/deprecation warnings 2019-11-08 14:32:30 +01:00
José Valim 49d865b1a0 Ensure reassigned variables are properly carried forward 2019-11-06 19:00:36 +01:00
Lau Taarnskov a903bda4e7 Add NaiveDateTime.local_now (#9472) 2019-11-04 22:51:20 +01:00
José Valim d844c8e6ba Improve error messages on keywords, closes #9467 2019-11-04 14:51:39 +01:00
José Valim 0c8414d739 Add Kernel.is_map_key/2 2019-11-04 12:47:26 +01:00
Eksperimental b8ce1f8053 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 2500d74b75 Improve coverage for non-integers in split/drop/take 2019-11-03 17:30:01 +01:00
Łukasz Jan Niemier 4863b4cde4 Add is_struct/1 to Kernel (#9470) 2019-11-03 17:22:33 +01:00
José Valim 6cfe09c50b Also handle parens in binary patterns 2019-11-02 18:02:30 +01:00
José Valim 4c27216f25 Handle binaries without specifiers 2019-11-02 17:28:58 +01:00
José Valim 11f3d22c7c Avoid multiple passes on binary specifier 2019-11-02 16:38:53 +01:00
Glauber Campinho 6f6e45f38a 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 a7150c1f1c Also validate types on remote types on self, closes #9460 2019-10-31 10:44:17 +01:00
Wojtek Mach 6a3345618a Warn if duplicate key is found in record (#9457) 2019-10-30 10:20:56 +01:00
José Valim a3b1ba5a44 Remove a need to merge unused vars 2019-10-29 17:17:53 +01:00
Gary Rennie 6a8fa2c7ef 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 a570d919da Speed up map intersperse for lists 2019-10-28 22:12:06 +01:00
HUANG Wei 21de3ae040 Introduce Enum.map_intersperse (#9454)
Fixes #9451
2019-10-28 21:41:14 +01:00
José Valim a23f179e42 Load IO opts only if file is empty 2019-10-26 22:17:54 +02:00
Michał 0ebc911237 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 642a794ace Allow a sorting function on min/max/min_by/max_by (#9427) 2019-10-24 12:51:31 +02:00
José Valim 387aa6eb17 Add asc/desc and compare support to Enum.sort (#9432) 2019-10-24 00:05:19 +02:00
José Valim 649914c394 Validate bind_quoted, closes #9406 2019-10-21 21:08:02 +02:00
José Valim 69d085abd4 Improve errors for calls on aliases 2019-10-21 21:02:00 +02:00
José Valim b7e0e1002b Add tests for spawn_opt being passed downstream and fix Supervisor spec 2019-10-21 19:10:21 +02:00
Hiroaki Osawa b7b6480b9c Add Enum.frequencies/1 and Enum.frequencies_by/2 (#9425) 2019-10-19 06:29:48 -05:00
Eric Meadows-Jönsson 6d3e3fa7d1 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 d46f0bd825 Support counter for var context (#9419) 2019-10-16 17:33:22 +02:00
Cade Ward 1ae0e436f7 Add guard to String.replace/4 for better error messages (#9398) 2019-10-16 16:22:20 +02:00
José Valim 8dc4e06c73 Mark match? catch-all clause as generated, closes #9411 2019-10-15 10:24:38 +02:00