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
Fernando Tapia Rico
66a289056e
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
c0ae3645f7
Consider options when running regexes on the fly
...
Closes #9343 .
2019-10-11 17:44:23 +02:00
Eric Meadows-Jönsson
c6da1cfaa8
Run checker on Code.require_file/1 ( #9393 )
...
Closes #9362 .
2019-10-10 23:11:10 +02:00
José Valim
f52f2c7952
Ensure compilation works for a variable named super, closes #9390
2019-10-09 19:11:04 +02:00
Eric Meadows-Jönsson
b3993aca6e
Use elixir_expand to simplify guard tests ( #9388 )
2019-10-08 19:25:57 +02:00
Eric Meadows-Jönsson
b3debbe1e8
Check more guard functions ( #9386 )
2019-10-08 04:02:20 +02:00
José Valim
fd49a67f34
Add defmodule tracing event
2019-10-07 16:12:52 -03:00
José Valim
f664700258
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
0883353f72
Fix defstruct code formatting with inline comments ( #9358 )
2019-09-26 17:43:41 -05:00
José Valim
b23b94e8b5
Revert "Add inspect/2 callback to Calendar ( #9128 )"
...
This reverts commit 23a68035be .
2019-09-24 12:01:52 +02:00
José Valim
36a1a984cb
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
0a0487a6d4
Update on_definition with Module.exists?/2 docs & test ( #9352 )
2019-09-17 10:09:58 +02:00
pete gamache
9213f61dd9
Warn on trailing commas in word list ( #9314 )
2019-09-10 08:58:05 -06:00
José Valim
94b507841b
Add struct keys to tracing on struct expansion
2019-09-01 09:52:18 -06:00
José Valim
4c1b559455
Ensure keyword replace and update preserve order, closes #9315
2019-08-25 12:31:07 +02:00
José Valim
3efda3155c
Raise multiple args errors in case with guards, closes #9311
2019-08-23 10:06:21 +02:00
hoomin
1f1a59d9f2
Standardize function expressions with multiple arities ( #9309 )
2019-08-22 18:05:15 -07:00
Eric Meadows-Jönsson
0f47a58bf8
Support struct patterns ( #9306 )
2019-08-22 13:28:05 -07:00
Marco Milanesi
d6d2e8220d
Support binary path in Protocol.extract_impls/2 ( #9304 )
2019-08-20 16:46:14 -07:00
Eric Meadows-Jönsson
807e205b75
Split Module.Types and add unit tests ( #9303 )
2019-08-20 11:46:13 -07:00
Jonathan Arnett
e6f47dcabd
Change List.Chars.to_charlist to return empty list when given nil ( #9299 )
2019-08-19 14:13:21 +02:00
José Valim
9504103f30
Do not expand structs when comparing AST on ExUnit.Diff
2019-08-19 13:55:14 +02:00
José Valim
4075613727
Improve assertion on function head test
2019-08-15 19:28:24 +02:00
José Valim
22f70afe4c
Warn when function head comes immediately after the implementation
2019-08-15 19:23:38 +02:00
Dmitry Shpagin
291a9307fd
Fix join/2 dot result at path end ( #9285 )
...
Closes #9284 .
2019-08-12 22:01:24 +02:00
José Valim
99f504e9dc
Use read-only naming for Module operations
2019-08-09 16:11:16 +02:00
Aleksei Matiushkin
9a959eac25
Make Module.open?/1 and family to match their docs ( #9278 )
...
* Make Module.open?/1 and family to match their docs.
* Cosmetics.
* Introduced internal not_closing state for modules.
It’s stored in a separate ETS and the last field of #elixir_code_server state to minimize impact.
* Use the same ETS for the state.
2019-08-09 15:43:43 +02:00
Eric Meadows-Jönsson
c5d5e7f462
Add inference of function head to find function clauses that will never match ( #9270 )
2019-08-08 14:02:27 +02:00
Tonći Galić
ebf31180f7
Add Function.identity/1 ( #9260 )
2019-08-06 13:20:24 +02:00
José Valim
b08593b9d1
Add compiler tracing ( #9247 )
...
This feature allows IDEs and other tools wanting to
perform source code analysis to do so reliably without
a need to reimplement Elixir's compiler expansion and
without relying on Elixir's private APIs.
This commit also adds :parser_options to compiler
options, which allows developers to combine both options
to retrieve more accurate information, such as columns.
2019-08-02 13:35:12 +02:00
Hassan Shaikley
919fb4cd5b
Add Access.fetch!/2 ( #9254 )
2019-08-01 00:10:22 +02:00
Wojtek Mach
030abba10c
Add :encoding option to StringIO ( #9250 )
2019-07-31 20:34:07 +02:00
José Valim
f6a7d3f6ef
Do not expand variables as macros in Macro.expand/2
2019-07-31 14:24:45 +02:00
José Valim
9540e9fd6a
Raise correct error message for incomplete interpolation in heredoc, closes #9252
2019-07-30 18:36:41 +02:00
José Valim
5ec685e041
Add version alongside app names in stacktraces, closes #9244
2019-07-29 21:07:53 +02:00