Commit Graph
3611 Commits
Author SHA1 Message Date
José Valim 685dd1a3e0 Return {:error, :unavalable} for ensure_compiled in a deadlock (#9543) 2019-11-19 09:12:40 +01:00
Eksperimental 0acab05f53 Use titlecase in Elixir, Erlang, EEx, Unicode, and Dialyzer (#9557) 2019-11-19 09:10:29 +01:00
Eksperimental 83ec6e3614 Use argument instead of arg in error messages (#9561) 2019-11-19 09:09:10 +01:00
José Valim b0e7bcd702 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 9917d3920a Make the number of attempted function clauses in FunctionClauseError more obvious (#9544) 2019-11-17 15:19:05 +01:00
José Valim dbf8a7a9fe Use version metadata in Erlang pass 2019-11-16 02:45:55 +01:00
Eric Meadows-Jönsson 623a91936b 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 97076019e4 Add async: true to tests using capture_io :stderr 2019-11-15 10:00:16 +01:00
Fernando Tapia Rico 1e9a781971 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 084373846b 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 d2418152d0 Use reverse rewrite in checker 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson 9587134429 Change Bitwise macros to rewrites 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson 8ece599b6d Add reverse rewrite and inline rules 2019-11-14 00:16:01 +01:00
Eric Meadows-Jönsson 904ce121e2 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 d2df63470f Move unification to Infer module 2019-11-13 16:42:25 +01:00
Eric Meadows-Jönsson 4ae121700a Split Infer into Expr and Pattern modules 2019-11-13 16:42:25 +01:00
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