Commit Graph
1799 Commits
Author SHA1 Message Date
José Valim 0c1df34645 Standardize more TODOs 2018-12-21 13:42:54 +01:00
José Valim d85ed42765 Update removal and deprecation annotations
In particular, all deprecated code would be removed on v2.0,
so we don't need to annotate dperecated code with a TODO to
remove it on v2.0.
2018-12-21 13:27:06 +01:00
José Valim 2d139352bb Fix cond scope and improve coverage, closes #8542 (#8544) 2018-12-21 12:54:04 +01:00
José Valim 5ce4b61991 Add :reduce to for comprehensions (#8531) 2018-12-21 12:51:28 +01:00
José Valim 3f6dd0b321 No longer wrap expression in binary as Erlang/OTP 20+ does it by default (#8530) 2018-12-16 20:23:24 +01:00
José Valim ec2e092fdd Add no_spawn_compiler_process option to previous OTP releases
Because Elixir may be compiled with Erlang/OTP 20
to run on Erlang/OTP 22.
2018-12-15 23:20:26 +01:00
Eksperimental bd37919247 Improvements to Operators guide (#8512) 2018-12-14 09:58:43 +01:00
José Valim bb5a66698c Raise for capture outside of function, closes #8516 2018-12-13 11:20:18 +01:00
Eksperimental f2d1b4209b ascii -> ASCII (#8499) 2018-12-10 09:24:34 +01:00
Björn Gustavsson 122dcbe90c Eliminate warning for an unused variable (#8431)
Fix a warning that has started to occur because of a recent bug fix in
Erlang/OTP (using fun M:F/A could suppress warnings for unused
variables).
2018-11-27 14:13:42 +01:00
Hans db9314374d Add special fn case to signature_to_binary (#8429) 2018-11-27 01:04:00 +01:00
José Valim 718263f823 Raise when passing invalid compiler flags to Elixir, closes #7839 2018-11-26 10:09:58 +01:00
José Valim 741ff046b7 Preserve user's choice on operators, closes #8417 2018-11-25 23:01:53 +01:00
Lars Wikman 8e08b3c16e Add missing spaces in error message (#8412) 2018-11-21 10:59:23 +01:00
Michał Muskała e89e9d874b Compile charlist interpolation more efficiently
Today charlist interpolation is quivalent to calling `String.to_charlist`
on the equivalent string interpolation. It can be more efficient by
leveraging chardata support in the `:unicode` module and encoding as a
list of literal binaries and results of `Kernel.to_string` calls for the
interpolated segments.
2018-11-20 17:54:13 +01:00
José Valim 774a9baa93 Resolve circular struct dependencies in typespecs (#8377)
Prior to this patch, if a module depends on the struct of
another module and that other module depends on the struct
of the first module inside typespecs, it would lead to a
compiler deadlock, which this deadlock would not happen
in "regular code".

This commit also adds a test to ensure @enforce_keys are
not enforced when expanding typespecs.

For now, we are using a compiler private API, but we should
provide a public version for it in a future commit.
2018-11-13 17:47:24 +01:00
Lau Taarnskov b8b1a4ba8a Add TimeZoneDatabase behaviour for time zone data.
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-11-13 17:43:59 +01:00
José Valim 929e58ca0e Make __info__ docs a callback, closes #8376 2018-11-12 14:16:40 +01:00
Eksperimental 28522ccb89 Use "etc." and not "etc" (#8379)
Command used to detect these typos:
$ ag -s "\betc[^.]"
2018-11-10 14:04:49 +01:00
Wojtek Mach 616263f9de Expand operands in size*unit bitstring modifier (#8375) 2018-11-08 19:42:55 +01:00
Eric Meadows-Jönsson d14f04c950 Change else clause error to warning (#8351) 2018-10-29 21:09:52 +01:00
José Valim 95bf439828 Update TODO notes 2018-10-29 19:04:19 +01:00
Fernando Tapia Rico d24ff660cd Avoid errors with more than one duplicated key (#8346)
Closes #8345
2018-10-26 17:44:09 +02:00
Fernando Tapia Rico 2d19ae4640 Remove backticks from error messages and test desc (#8343)
To keep consistency in the codebase.
2018-10-26 08:38:01 +02:00
Mitchell Hanberg 749d89139c Improve error message for invalid quoted expression (#8336) 2018-10-25 19:37:04 +02:00
Eksperimental bd9ac87d07 Update use of numbers as adjectives (#8309)
- Replace "two element tuples" with "two-element tuples" for every number in 1..10
- Replace "2-element tuples" with "two-element tuples" for every number
- "1-based" with "one-based"
- "0-based" with "zero-based"
2018-10-21 00:03:38 +02:00
Fernando Tapia Rico c190f09d5c Allow @type, @opaque, @typep, @spec, @callback, and @macrocallback to be used as module attributes (#8289)
Closes #8085
2018-10-18 22:45:13 +02:00
Fernando Tapia Rico 83519a33cd Remove warning related to imperative assignments (#8288)
Closes #8285.

This warning has to be removed because all of the forms were
unified in v1.7, making case/with/if to behave the same.
That leads to undesired warnings in cases such as:

    a = 1

    with {:ok, a} <- my_fun(a) do
      :ok
    end
2018-10-17 15:43:24 +02:00
José Valim 4a5bcaaa8e Ensure eval_quoted properly resets last definition, closes #8261 2018-10-09 20:49:38 +02:00
José Valim 1ca25436be Use the no_spawn_compiler_process in more recent release
See https://github.com/erlang/otp/pull/1972.
2018-10-03 14:02:46 +02:00
José Valim 159e9655d5 Bypass erl_lint and spawn compiler processes manually (#8241)
This speeds up the Elixir compiler from 5-10% as we no
longer do duplicate work on erl_lint and expand_records.
We also avoid the copying of messages by controlling
exactly when the compiler spawns new processes.
2018-10-02 11:18:44 +02:00
Glauber Campinho 741dfda9f4 Let the undefined function error be performed in Elixir-land (#8231)
Refers to #5800
2018-10-01 12:22:38 +02:00
Fernando Tapia Rico e1e096ab2e Warn on underspecified opaque types (#8232)
Refers to #5800

Performs the erl_lint check "underspecified_opaque, {TypeName, Arity}}" in Elixir.

After reading the Erlang/OTP codebase, it seems an "underspecified opaque" is an opaque type of arity 0 with a spec of "term" or "any".
2018-09-28 10:58:31 +02:00
Glauber Campinho 3fcc9241db Optimizes multiple :maps put and merge operations (#8223)
Optimizes :maps.put/3 to a VM operation instead of a remote call, including nested calls to it.
It does the same for :maps.merge/2 with a simple map on the right side.

Closes #7353
2018-09-28 08:40:27 +02:00
Andrea Leopardi e0d1c2e4ca Fix error messages for some "try" errors (#8220)
Related to #8219.

The errors could come from "def" as well (this is stored in the :origin 
key in the metadata).
2018-09-23 21:08:10 +02:00
Andrea Leopardi 9e302cbd01 Forbid using only the "else" clause in "try" (#8219)
Closes #8146.

Now using "else" without a "rescue", "catch", or "after" in "try" 
expressions is not allowed anymore.
2018-09-23 12:09:47 +02:00
Glauber Campinho f332273228 Use head definition meta to warn about unused args (#8198)
Fixes #8184
2018-09-16 10:44:26 +02:00
José Valim 050f10e849 Improve message for unnecessary quotes, closes #8197 2018-09-14 22:05:23 +02:00
Glauber Campinho fad27bacab Remove Guard test tuple_size(...) can never succeed dialyzer warning on try (#8196)
Fixes #8157
2018-09-14 21:42:30 +02:00
Fernando Tapia Rico 6b5c167d23 Raise errors with duplicated entries on import (#8188)
Fixes #8187
2018-09-12 10:43:50 +02:00
José Valim cd439540fc Revert wrong warning on parse_transforms removal 2018-09-07 10:04:57 -07:00
Glauber Campinho 3d9d799a91 Fix invalid expansion for remote (#8154)
When left side is expanded but become invalid, the expansion result in the AST leaking for the user, for example:

```
iex(1)> __ENV__.line.foo
{{:., [line: 1], [1, :foo]}, [line: 1], []}
```

This checks the expanded left to ensure that it's safe
2018-09-06 04:43:57 -07:00
Fernando Tapia Rico b59d280a79 Use imported function in elixir_parser.yrl (#8151) 2018-08-29 14:19:50 +02:00
Eksperimental cdd9dae8b4 "Fall back" the verb is 2 separate words (#8131) 2018-08-27 12:10:22 +02:00
Fernando Tapia Rico caf62d5355 Use ETS instead of ets in documentation (#8099) 2018-08-17 00:35:49 +02:00
José Valim 36718cb41b Correctly tag struct invocations, closes #8097 2018-08-16 23:56:47 +02:00
José Valim 6d4c581cf2 Improve unused variable warnings (#8071) 2018-08-15 12:13:53 +02:00
Fernando Tapia Rico df683c1d72 Fix arity of try/1 in :elixir_import.special_form (#8079)
Fixes #8078
2018-08-14 12:56:33 +02:00
Glauber Campinho 495d1646b2 Small optimization on elixir_bitstring:expand/4 (#8074)
`elixir_env:mergea(EV, EC)` is always equivalent to `EV` so we can avoid the operation.
Similar to #8069
2018-08-12 10:05:59 +02:00
José Valim 4f84f1bf2f Ensure Macro.expand/2 does not change the meaning of interpolations 2018-08-11 20:42:24 +02:00