Commit Graph
3287 Commits
Author SHA1 Message Date
José Valim 34befaaa36 Allow to prune metadata while escaping (#7949)
We use this option in ExUnit as we are escaping
the code to eventually convert it to a string
representation and therefore the metadata is not
relevant.
2018-07-21 12:56:07 +02:00
José Valim dc25bb8e14 Properly annotate key errors for structs, closes #7935
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-07-19 22:42:21 +02:00
José Valim c5e0704916 Move some runtime deprecations to compile time
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-07-19 22:42:14 +02:00
Fernando Tapia Rico ae15d1822f Check duplicated @on_load attributes (#7921) 2018-07-18 19:34:31 +02:00
László Bácsi 205204d04b Annotate @doc metadata when something is a guard (#7893) 2018-07-15 09:37:56 +02:00
José Valim ea3ee48a5f Test we don't warn for unecessary quotes in uppercase atoms/keywords 2018-07-14 08:31:26 +02:00
Łukasz Samson 7ea42588ce Add Kernel.ceil/1 and Kernel.floor/1 buildins (#7888)
Fixes https://github.com/elixir-lang/elixir/issues/7882
2018-07-13 12:54:09 +02:00
José Valim 658b90c399 Properly add parens around when with keywords as argument 2018-07-13 00:12:58 +02:00
László Bácsi 7ba5d1c0a0 Show documentation metadata in IEx (only since and deprecated for now) (#7886)
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-07-12 20:15:22 +02:00
Michał Muskała 06b5eae89f Compile protocols in elixir syntax (#7832)
This siwtches protocol compilation to happen on the epxnaded Elixir AST
instead of the Erlang AST. This is slightly less complex and opens
possibility for easy "partial" compilation of protocols.

Additionally instead of rewriting specs on consolidation, this marks the
functions that end-up being rewritten with @dialyzer :nowarn_function to
disable overly eager dialyzer warnings.
2018-07-12 14:43:16 +02:00
Lukasz Samson fdb9f792e9 Fix error when :trim_bom is used with :encoding
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2018-07-12 14:36:46 +02:00
José Valim 94f3d60a26 Hard deprecate previously deprecated APIs 2018-07-12 12:44:03 +02:00
Andrea Leopardi 6023568bcf Deprecate using non-empty lists with the Collectable protocol (#7785)
Closes #7421.
2018-07-12 12:13:32 +02:00
José Valim 35ac568044 Require Erlang/OTP 20+ 2018-07-12 12:12:00 +02:00
José Valim 16b358cd54 Do not send binread to streams with encoding, closes #7729 2018-07-12 11:38:26 +02:00
José Valim d33bac539c Allow :deprecated to be given as doc metadata 2018-07-11 11:01:57 +02:00
László Bácsi 0267ae2c7e Support adding arbitrary docs metadata with @doc keyword() (#7852) 2018-07-11 10:19:38 +02:00
Eksperimental ec0435b84f Change wording in error giving options (#7875) 2018-07-11 10:04:08 +02:00
José Valim 260dde330f Do not capture stderr on async tests
Plus the syntax above will raise in future versions.
2018-07-10 22:29:46 +02:00
José Valim bed2547895 Properly inflect names for structs 2018-07-10 14:02:41 +02:00
Laszlo Bacsi 1aff3b1370 Add since, deprecated, and defaults to docs metadata 2018-07-10 13:42:20 +02:00
José Valim beb596d37c Warn on unnecessary quotes (#7838) 2018-07-10 10:27:02 +02:00
José Valim 4db36e08d7 Do not force clauses with comments to be unfit (#7843) 2018-07-09 12:54:50 +02:00
José Valim 9bf4826210 Fix erlang-based tests 2018-07-09 11:22:23 +02:00
José Valim 6cf3d8c20a Return error tuple for long quoted atoms 2018-07-09 10:49:38 +02:00
José Valim 9cd93a80d5 Add more test cases to invalid interpolation 2018-07-09 10:28:05 +02:00
Adrian Cruz dd880e209c Return an error tuple for interpolation in function call (#7836) 2018-07-09 10:24:26 +02:00
José Valim 83e6358b14 Fixes to binary generators with collectable into in comprehensions
This fixes two bugs/limitations:

  1. When using dynamic size in the binary pattern
  2. When using literals in the binary pattern

Closes #7829.
2018-07-05 13:09:18 +02:00
László Bácsi caa90b563a Migrate to Code.fetch_docs/1 (#7828) 2018-07-05 00:45:04 +02:00
José Valim cd0cb7cca4 Do not leak inner key representation in signature 2018-07-03 23:30:41 +02:00
László Bácsi 2ecb5d00bd Adopt EEP 48 and add Code.fetch_docs/1 (#7826)
At this point the legacy chunk and the original `Code.get_docs/2`
implementation is still in place, but the tests have been adjusted to
exercise `Code.fetch_docs/1` instead.
2018-07-03 18:43:41 +02:00
José Valim b0cc54468e Unify handling of keywords with and without parens 2018-07-03 17:57:13 +02:00
José Valim 4416854a9d Improve error messages for boolean operators with =, closes #7730 2018-07-03 14:37:41 +02:00
José Valim 005f432671 Warn for redefined docs across clauses
Closes #7817
2018-07-03 13:06:31 +02:00
José Valim e7bd7c98e0 Do not include overridables in definitions, closes #7823 2018-07-03 12:39:58 +02:00
José Valim 2ece95c1db Handle other unescaped tokens in tokenizer 2018-07-03 12:14:16 +02:00
Adrian Cruz 9707843134 Return error on bad hex escaping (#7809)
As discussed in #7270, it would help if we return error tuples
instead of exceptions. This PR does it for string unescaping.
2018-07-03 12:03:43 +02:00
Alex Castaño 374480e2e1 Annotates arithmetic error for better debug experience 2018-06-27 12:32:04 +02:00
Fernando Tapia Rico e3b2b09cce Make test suite for assert_no_guard more robust (#7801)
If I got it right, one of the reasons for that change was to get the message:

> invalid expression in guard, **!** is not allowed in guards. To learn more about guards, visit: https://hexdocs.pm/elixir/guards.html  

instead of:

> invalid expression in guard, **case** is not allowed in guards. To learn more about guards, visit: https://hexdocs.pm/elixir/guards.html

This change should make the test suite more robust for future changes or refactors :)

In addition, I've split a couple of strings that were exceeding the maximum line length (98). By the way, should the formatter warn when it cannot keep the code under the desired line length? maybe with a `--strict` flag?
2018-06-27 12:22:39 +02:00
Devon Estes e07ccb1df5 Add blame callback for KeyError (#7803)
This starts with an initial implementation of the `blame/2` callback
for `KeyError` to add some helpful `did_you_mean` feedback for
potentially typo'd keys. Right now it's only implemented for maps and
keyword lists, and only for atom keys.
2018-06-27 11:27:06 +02:00
Sihui Huang 2a610bd005 Add assert no guard on !, && and || (#7797) 2018-06-26 09:39:43 +02:00
José Valim 5fbc8676c2 Improve error messages for bad map key patterns 2018-06-25 16:56:57 +02:00
Michał Muskała d225f4a373 Restore and/or optimisation (#7764)
The optimize_boolean option is very sensitive to the order of
clauses and the optimisation was not happening for and/2 and or/2.

Add regression tests to ensure that won't happen again.

Removes tests that dialyzer does not emit warnings for optimised
and and or - those warnings could actually be helpful.
2018-06-23 09:21:15 +02:00
lukevmorris 2f268088af Warn if nested comparisons are found (#7773) 2018-06-21 18:59:52 +02:00
Derek Kraan 95acb1f751 Include caller information on struct expansion errors
Closes #7752
2018-06-21 18:48:55 +02:00
José Valim 9411636d12 Move did_you_mean for undefined function error to Exception.blame 2018-06-21 18:47:42 +02:00
José Valim 5ab60299b5 Do not break assertion arguments apart if they are all quoted literals 2018-06-21 16:41:05 +02:00
José Valim 896e0664a0 Improve error message on nil dispatch 2018-06-21 15:38:04 +02:00
José Valim d2799bade3 Blame badarg on apply/3 for better error messages 2018-06-21 14:24:28 +02:00
José Valim 22245a44fe Only show mismatch hints for fn+do/end 2018-06-21 14:08:30 +02:00