Commit Graph
70 Commits
Author SHA1 Message Date
José Valim da637b7523 Collect function errors where possible in elixir_bitstring and elixir_expand 2022-11-28 16:15:34 +01:00
José Valim bee0bb56be Do not emit warnings when formatting code
Closes #11595.
2022-01-26 13:37:53 +01:00
Luc Fueston cba50b7a28 Warn on confusable non-ascii identifiers (UTS 39, C2) (#11582) 2022-01-21 09:37:25 +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
José Valim e480151fe7 Add Code.Fragment.container_cursor_to_quoted/2 (#11315) 2021-10-16 15:12:09 +02:00
José Valim f05ac0a9a4 Improve docs and remove unnecessary field 2021-10-06 21:28:07 +02:00
José Valim 2a3dfa7d7e Pass annotation forward when building Erlang AST 2021-09-11 10:21:31 +02:00
José Valim 5eb2efe543 Break Macro.Env apart (#11164)
Previously, the internal Elixir expansion pass worked directly on
Macro.Env. However, this poised an issue, if we want to track
more information in the pass, we ended up exposing it on
Macro.Env, making it larger, and potentially slowing down
operations such as __ENV__ serialization.

This commit refactors the expansion pass to work with two
structures, the Macro.Env struct and a #elixir_ex{} record.
2021-08-03 13:35:15 +02:00
José Valim c0edad99b8 Remove TODOs related to Erlang/OTP 22+ 2021-03-30 09:46:43 +02:00
Pablo Costas 3cee477f51 Fix tokenizer emitting repeated warnings in the REPL (#9924)
Now we only emit tokenizer warnings upon tokenization success.
2020-04-10 00:48:49 +02:00
José Valim f8c2610004 Fix Erlang compiler bug on 21.0 2020-04-10 00:46:37 +02:00
José Valim 63837a720b Refactor binary handling 2020-04-05 20:15:50 +02:00
José Valim a7af365d25 Allow file, line and context to be dynamically set on quote, closes #9721 2020-01-23 20:26:16 +01:00
José Valim dbf8a7a9fe Use version metadata in Erlang pass 2019-11-16 02:45:55 +01:00
José Valim 5944706239 No need to track stacktrace usage 2019-11-03 13:56:39 +01:00
José Valim 7648c0f3a8 elif to else 2019-11-03 13:06:30 +01:00
Łukasz Jan Niemier 9fca33e09f Cleanup TODOs for OTP 21+ (#9477) 2019-11-03 13:05:18 +01:00
José Valim cf881389cf Remove unecessary Erlang macro 2019-11-01 19:19:54 +01:00
José Valim cbbaa1e6e8 Apply mergev optmization on erlang pass 2019-10-29 19:37:12 +01:00
José Valim f3d5b683dd Ensure local captures work correctly on macro expansion
Closes #9245
2019-07-27 11:28:05 +02:00
Arjan Scherpenisse 13c51a872c Implement static_atom_encoder tokenizer option (#8956) 2019-04-14 19:44:17 +02:00
José Valim af9ee699ad 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
José Valim 74f5740b2c 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
Michał Muskała 25aede7984 Fix all compiler warnings (#7992) 2018-07-27 16:42:24 +02:00
Michał Muskała 6ebeabf0b0 Separate testing for unquotes from escaping 2018-07-25 00:10:02 +02:00
Michał Muskała 276a4783f4 Inline construction of remote erlang calls in compiler 2018-07-25 00:10:02 +02:00
José Valim 94c3149ca9 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 fc8de8a440 Warn on unnecessary quotes (#7838) 2018-07-10 10:27:02 +02:00
José Valim 216d6d6edf Add hints on mismatched do/end and others pairs
When you are working on large files and you add new code,
you may forget to add a `do` or an `end`. In those cases,
the error message usually points to the first `do` or the
last `end` in the file, which are usually far away from
the source of the error.

This pull request adds a simple heuristic based on the
indentation of the tokens, to try to provide hints of
where the source may be. Those hints are not deterministic
but they may be able to point users to the source of the
problem.

For example, in this case:

    defmodule MyApp do
      def one do
      # end

      def two do
      end
    end

we know that we now that `def two do` is happening on the
same indentation as `def one do`, which may mean that
`def one do` was not closed properly. We store this as a
hint in case the terminators do not match later.

Similarly, in the case below:

    defmodule MyApp do
      def one
      end

      def two do
      end
    end

The `end` on line 3 will end-up closing the defmodule `do`,
on line 1. Because their indentation do not match, it may
be that there is a missing `do`, where the `end` was supposed
to align.

Some basic testing show those heuristics work on the majority
of the cases, but we will only be sure when we have enough
feedback from the community.
2018-06-10 13:55:49 +02:00
Michał Muskała a3bc40a91b Introduce __STACKTRACE__ (#7134) 2018-02-03 14:09:47 -02:00
José Valim c0997aebf2 Remove file from elixir_erl record 2018-01-20 19:42:08 +01:00
José Valim 4f7309ff4f Remove export_vars in elixir_erl record 2018-01-20 19:42:08 +01:00
José Valim c1bd106613 Rely on side effects for preserving comments
The previous implementation would not lead to parsing
errors in interpolations since code inside interpolation
is parsed immediately.
2017-10-05 13:27:25 +02:00
José Valim 74cff0efc5 Allow strings/atoms/charlists to be emitted unescaped 2017-08-23 17:36:09 +02:00
José Valim 041f138b71 Continue raising on unbound __CALLER__ 2017-07-13 15:16:19 +02:00
José Valim a8c482df3f Ensure with is tail call optimizable
Closes #6251
2017-07-11 20:24:21 +02:00
José Valim 02b47b2bbe Move match vars handling and warnings to elixir_expand
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2017-07-07 16:11:40 +02:00
José Valim a735e00018 Ensure defaults and defoverridable work together, closes #6300
This commit changes the private super implementation to have
a tuple with the {kind, name} as first argument.
2017-07-06 15:47:56 +02:00
Alex Jiao b86b95df89 Add a preserve_comments option to the tokenizer (#6222) 2017-06-21 10:09:52 +02:00
José Valim 2f663ce3a2 Add non-quoted Unicode atoms and variables (#6158)
It follows Unicode Annex #31.

See the Unicode Syntax document for a more in-depth reference.
2017-05-27 22:43:05 +02:00
José Valim e27bacbe5c Keep ?var_context per module to avoid chance of conflicts 2017-02-24 01:29:44 +01:00
Aleksei Magusev 77efb4f96c Use elixir instead of Elixir for var_context/0 2017-02-21 21:01:28 +01:00
Aleksei Magusev 5ea54ffc4f Add var_context/0 helper macro 2017-02-21 21:01:28 +01:00
José Valim c56f6c04c1 Fix how the generated annotation is handled in Elixir 2017-02-20 23:14:16 +01:00
Aleksei Magusev c1c009537a Rename m/2 helper macro to key/2 in the main header file 2017-02-19 21:56:05 +01:00
José Valim a722e6c18c More module renaming and organizing 2017-02-19 21:20:43 +01:00
José Valim adb0a0f095 Move erlang modules to new erl namespace 2017-02-19 20:20:59 +01:00
José Valim d01d3af856 Start moving files to elixir_erl 2017-02-19 19:40:21 +01:00
José Valim e2db69cf69 Convert default argument handling to Elixir pass 2017-02-18 19:44:38 +01:00