Commit Graph
2182 Commits
Author SHA1 Message Date
José Valim b48623a96e Add compile-time dependencies on require
Projects like Plug use require to establish compile
time dependencies inside a Plug. The fact require
only added a compile-time dependency in v1.13.0 was
therefore a regression, addressed by this commit.
2022-02-14 12:39:54 +01:00
José Valim b52f274406 Add .. as a nullary operator that returns 0..-1//1 (#11623) 2022-02-13 15:18:53 +01:00
José Valim 2676f8b221 Allow only single- and highly restricted mixed-scripts in identifiers (UTS39 C3) (#11621) 2022-02-11 20:44:06 +01:00
José Valim 155d6c5da3 Do not break signatures over multiple lines 2022-02-01 10:04:14 +01:00
José Valim 41b6b606fb Ensure versioned_vars are updated at the end of evaluation 2022-01-27 08:18:23 +01:00
José Valim bee0bb56be Do not emit warnings when formatting code
Closes #11595.
2022-01-26 13:37:53 +01:00
José Valim 851ac27272 Run unicode security linting on more tokens 2022-01-21 10:50:02 +01:00
Luc Fueston cba50b7a28 Warn on confusable non-ascii identifiers (UTS 39, C2) (#11582) 2022-01-21 09:37:25 +01:00
felipe stival c3333e6aab Fix duplicate bindings causing weird behaviour (#11584)
Before this fix, evaluating `b = a` with assignments of: `a: 1, a: 2, c:
3` would eval AST equivalent to `^c = a`. This happened due to binding
normalization generating version numbers larger than the total number of
bindings. Later in the pipeline, the number of bindings is used to
compute the next version number, which would then conflict with an
existing binding.

This commit fixes that by not increasing the version number when
a repeated binding is normalized.
2022-01-19 19:35:33 +01:00
José Valim 07cc16717b Allow any expression in bitstring size outside of matches/guards 2022-01-12 01:47:11 +01:00
Jorge Bejar 4c40630c08 EEP 52: Support for size expression in bitstring matching (#11558) 2022-01-11 21:42:28 +01:00
Paulo Daniel Gonzalez ef2e544749 Add nudge to do expression error (#11552)
Closes https://github.com/elixir-lang/elixir/issues/11551
2022-01-07 20:41:26 +01:00
felipe stival 27c623cd1e EEP 52: Allow pins inside map keys in matches (#11544) 2022-01-06 00:48:04 +01:00
Michał Łępicki 9e898f8b5a Remove references to HiPE (#11543)
* Fix typo in Dialyzer CI step name

* Remove references to HiPE
2022-01-05 13:37:17 +01:00
felipe stival c764bf3afa Use :erlang.atom_to_binary/1 (#11541)
This function was added in OTP 23 and its the functional equivalent to
`:erlang.atom_to_binary/2` with `:utf8` as the second argument.
2022-01-05 12:54:00 +01:00
Łukasz Samson 0a8b03f397 Add Node.spawn_link (#11540) 2022-01-05 12:11:04 +01:00
José Valim a9cecc2e3a Remove support for Erlang/OTP 22 2022-01-05 09:14:03 +01:00
Aleksei Matiushkin 5f8994119c Fix the nested uniq: acc name clash by preserving a scope (#11532) 2022-01-01 09:00:18 +01:00
José Valim d06a4e3b00 Simplify context module handling 2021-12-22 12:47:13 +01:00
José Valim 4e5c5f2f70 Ensure context modules are handled in optimized defmodule 2021-12-22 12:19:02 +01:00
José Valim 080528a308 Simplify contract between checker and compiler 2021-12-18 22:05:49 +01:00
José Valim 8c2ec72875 Do not emit warnings on Cursor.Fragment.container_cursor_to_quoted/2 2021-12-16 16:13:39 +01:00
José Valim a74d0cc390 Deprecate <|> 2021-12-13 20:13:03 +01:00
felipe stival 85d86fd120 Change approach: never show error if line is empty (#11466) 2021-12-10 09:27:25 +01:00
José Valim f1b9d3e818 Deprecate use Bitwise and ~~~
Use `import` instead.
2021-12-09 21:08:57 +01:00
José Valim 0a972503ec Add Macro.classify_atom/1 and Macro.inspect_atom/2 (#11446)
Today the formatter still uses some private APIs
and this commit aims to expose some of them.
In particular, Macro.classify_atom/1 was added to
expose if an atom is an alias, an identifier, quoted,
or unquoted.

Note that the API does not say anything about
operators, since they can fall within three distinct
categories:

  * unquoted and callable, such as, `+`, `-`, and
    most operators

  * unquoted and not callable, such as, `.`, `..`,
    and `..//`, which would be ambiguous when used
    as `Module.OP()`

  * quoted but callable, such as `::`, which is
    ambiguous in the atom syntax but not as calls

This information still remains private, especially
because most times operators are used, we often still
want to learn about their precedence too.

We also exposed `inspect_atom/2` with three
distinct clauses to cover the different scenarios
atoms can be inspected at runtime and in source
code.
2021-12-05 15:02:06 +01:00
José Valim a0ee96bd0e Warn on ::: to avoid ambiguity
The formatter already rewrote it to :"::" since
its conception.
2021-12-05 10:40:19 +01:00
José Valim f821efc965 Warn if an outdated lexical tracker is given on eval 2021-11-26 23:00:18 +01:00
José Valim 0a1e5eaf0a Do not print control chars as unexpected tokens 2021-11-26 21:02:07 +01:00
José Valim c0d535bab7 Disable ssa and bool passes (#11420)
Module bodies, especially in tests, tend to be
long, which affects the performance of passes
such as beam_ssa_opt and beam_bool. This commit
disables those passes during module definition.
As an example, this makes loading Elixir's test
suite 7-8% faster.
2021-11-26 06:46:50 +01:00
José Valim af3f7eedcf Preserve opts while formatting failed inspect struct
Also make formatting consistent.
2021-11-25 18:11:05 +01:00
Eksperimental e352c889cb Improve user experience when there is a faulty Inspect implementation (#11403) 2021-11-25 17:41:03 +01:00
José Valim acbc04a902 Warn on trailing commas on calls, closes #11399 2021-11-19 11:46:46 +01:00
José Valim 5bb9633273 Reject bidirectional formatting characters (#11391) 2021-11-15 21:08:37 +01:00
José Valim a1b7ecc259 Support escaping of terminators in uppercase sigils heredocs for consistency, closes #11390 2021-11-15 14:21:12 +01:00
José Valim e602537856 Fix bootstrap 2021-11-10 19:37:21 +01:00
José Valim ec25ce0c6c Do not crash on duplicate bindings, closes #11378 2021-11-10 19:27:53 +01:00
José Valim 1a880f38bd Consistently return an empty list for System.stacktrace 2021-11-09 21:57:22 +01:00
José Valim 293a1ae27b Deprecate features pending for v1.14 2021-11-09 18:34:01 +01:00
Michał Łępicki 1eccae1232 Settle elixir_errors:parse_error/6 InputString as charlist (#11345) 2021-10-25 23:09:32 +02:00
José Valim 3b2f5057df Only consider StartColumn on first line 2021-10-25 16:33:16 +02:00
felipe stival ac80ddc123 Show code snippet on syntax and token missing errors (#11332)
Closes #11280.
2021-10-25 16:18:29 +02:00
José Valim 5bb865fab6 Handle more incomplete expressions in cursor_context_to_quoted 2021-10-24 17:22:01 +02:00
José Valim 65ab34224f Include column in warnings emitted by compiler (#11339)
We also extend Mix.Tasks.Compiler.Diagnostic
to include {line, column} as possible position.
We also explicitly document the behaviour of
line=0, which is equivalent to unknown line.
Elixir was already setting the line to zero in
multiple occasions prior to this patch, so this
patch makes it official and we stop returning `nil`
for said cases.
2021-10-24 16:28:36 +02:00
José Valim f2bd03273f Include column in more errors whenever possible 2021-10-24 15:58:19 +02:00
José Valim 7af65d5d97 Revert "Default to including columns by default"
This reverts commit 01107a380c.

Including columns by default make Ecto test suite
consistently 10% slower and that's likely to replicate
across the board.
2021-10-23 10:28:02 +02:00
José Valim 01107a380c Default to including columns by default
This changes the default for Code.string_to_quoted/2
and friends, so it may break tests matching explicitly
on the output, but the functionality wise the AST should
still be the same. The reason why it is important to make
this change is to provide better error messages throughout
Elixir.
2021-10-22 21:21:19 +02:00
José Valim e480151fe7 Add Code.Fragment.container_cursor_to_quoted/2 (#11315) 2021-10-16 15:12:09 +02:00
sabiwara 0a26aa543b Tokenizer uses static_atoms_encoder on quoted keyword keys (#11313)
Closes #11312
2021-10-15 08:10:18 +02:00
José Valim f05ac0a9a4 Improve docs and remove unnecessary field 2021-10-06 21:28:07 +02:00