Commit Graph
262 Commits
Author SHA1 Message Date
José Valim b52f274406 Add .. as a nullary operator that returns 0..-1//1 (#11623) 2022-02-13 15:18:53 +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
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 acbc04a902 Warn on trailing commas on calls, closes #11399 2021-11-19 11:46:46 +01: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 e480151fe7 Add Code.Fragment.container_cursor_to_quoted/2 (#11315) 2021-10-16 15:12:09 +02:00
José Valim 7a9a00d9e2 Add power operator (#11241) 2021-09-14 11:08:34 +02:00
José Valim 1789c1eb9b Handle OP/ARITY syntax more consistently 2021-08-27 21:39:14 +02:00
Dorgan 1c8ba7489d Preserve heredoc indentation metadata (#11128) 2021-07-20 08:16:21 +02:00
Dorgan 41dd2ab9f4 Add more token metadata to aliases and remote calls (#11038) 2021-06-05 19:22:40 +02:00
José Valim b44bbe536c Do not assume that literals in blocks have been normalized 2021-05-27 13:15:46 +02:00
José Valim effa61ac96 Improve error message for expression after keyword
For maps and lists:

    $ elixir -e "%{foo: :bar, :baz => :bat}"
    ** (SyntaxError) nofile:1: unexpected expression after keyword list. Keyword lists must always come last in lists and maps. Therefore, this is not allowed:

        [some: :value, :another]
        %{some: :value, another => value}

    Instead, reorder it to be the last entry:

        [:another, some: :value]
        %{another => value, some: :value}

    Syntax error after: ','
        (elixir 1.13.0-dev) lib/code.ex:655: Code.eval_string_with_error_handling/3

For calls:

    $ elixir -e "call foo: :bar, :baz"
    ** (SyntaxError) nofile:1: unexpected expression after keyword list. Keyword lists must always come as the last argument. Therefore, this is not allowed:

        function_call(1, some: :option, 2)

    Instead, wrap the keyword in brackets:

        function_call(1, [some: :option], 2)

    Syntax error after: ','
        (elixir 1.13.0-dev) lib/code.ex:655: Code.eval_string_with_error_handling/3

Closes #10973.
2021-05-12 13:34:06 +02:00
José Valim a1989d01f8 Respect keywords in access in code formatter 2021-05-11 12:37:52 +02:00
José Valim 6055a7eb2c Allow unquote_splicing inside maps with no parens 2021-05-04 23:59:38 +02:00
José Valim a080002de9 Improve warnings 2021-03-26 13:19:04 +01:00
José Valim b849235472 Support stepped ranges (#10810) 2021-03-25 07:32:06 +01:00
José Valim c9a171da5b Deprecate ^^^ 2021-03-23 10:23:58 +01:00
José Valim 9da5cb8b9e Rewrite not (foo in bar) to foo not in bar 2021-03-07 20:00:08 +01:00
José Valim ae3ef6732c Generalize operator completion on IEx' parser 2021-02-12 14:19:31 +01:00
Eksperimental 6944a67965 Revise use of Note and Notice verbs (#10264) 2020-08-14 07:59:34 +02:00
José Valim cd2ed7c7cf Revert "Consistently handle empty blocks"
Actually, we don't allow `-> [EMPTY]` anywhere else.

This reverts commit 00a6401f3f.
2020-06-25 12:32:07 +02:00
José Valim 00a6401f3f Consistently handle empty blocks 2020-06-24 20:48:05 +02:00
José Valim fbaba1cce1 Handle ; inside empty parens, closes #9964 2020-04-26 11:42:20 +02:00
Ivan Rublev 0ae5f4fda5 Add +++ and --- with right associativity to the list of custom operators (#9954) 2020-04-21 13:03:31 +02:00
Wojtek Mach e922211913 Use new ExDoc extras auto-links (#9912) 2020-03-27 00:05:48 +01:00
José Valim 48dc01829f Do not warn on nullary calls without parens 2020-03-12 13:11:11 +01:00
José Valim 9f50f7de7e Do not emit invalid code when formatting assocs in maps, closes #9771 2020-02-01 11:18:28 +01:00
Wojtek Mach 1303afef90 Fix bug: move :indentation from sigil meta to binary meta (#9738)
We need it there so we can retrieve it like this:

    defmacro sigil_E({:<<>>, meta, [expr]}, []) do
      options = [
        line: __CALLER__.line + 1,
        indentation: meta[:indentation] || 0
      ]

      EEx.compile_string(expr, options)
    end
2020-01-15 16:11:38 +01:00
Wojtek Mach c3752ac4df Add :indentation to sigil heredoc meta (#9725) 2020-01-14 20:45:24 +01:00
Devon Estes fc0ef36880 Always capture delimiter metadata for sigils (#9671)
This makes it so we're always capturing delimiter metadata for sigils
instead of requiring the `token_metadata` option. This means that we can
now show the correct sigils in ExUnit diffs (and elsewhere) for code
examples.
2020-01-05 16:07:58 +01:00
Eksperimental e8378b83da Replace usage of "e.g." (#9571) 2019-11-22 11:26:23 +01:00
José Valim 08d6fe8cb8 Add parens to static remote nullary calls
test/erlang/module_test.erl have also been removed
as they have been ported elsewhere.
2019-11-08 17:59:08 +01:00
José Valim 2493ff907d Remove unused funtionality and erase pdict properly 2019-10-25 15:29:46 +02:00
José Valim 8c5c466a71 Add literal encoder option to Code.string_to_quoted 2019-06-19 00:04:08 +02:00
José Valim 0803049293 Add end of expression token information
This also renames pairing_metadata to token_metadata,
as it mostly contains information about related tokens
and not necessarily pairs.
2019-06-18 00:25:22 +02:00
José Valim e7097d778a Exposing pairing metadata (#9146)
This introduces five new metadata nodes:

  * `do` - contains metadata about do location in a function call with
    `do/end` blocks
  * `end` - contains metadata about end location in a function call with
    `do/end` blocks
  * `closing` - contains metadata about the closing pair, such as a `}`
    in a tuple or in a map, or such as the closing `)` in a function call
    with parens
  * `eol` - is set to true when the opening pair, such as `{` or `(`, are
    followed by the end of the line
  * `delimiter` - contains the opening for sigils (such as `"{"`, `"/"`,
    etc)
2019-06-17 16:38:52 +02:00
José Valim 3d6947bb39 Rename :end metadata to less ambiguous :closing 2019-06-16 00:01:48 +02:00
José Valim d9af62f7e5 Ensure third element in location tuple is either nil or an integer 2019-05-09 10:59:13 +02:00
José Valim 52578ff2ac Nest all terminator metadata under :end key 2019-05-09 10:28:18 +02:00
José Valim 64eb6af13a Rely on IO.warn whenever possible 2019-01-18 14:59:20 +01:00
José Valim f93d703979 Standardize more TODOs 2018-12-21 13:42:54 +01:00
Eksperimental 142bf57b7a Improvements to Operators guide (#8512) 2018-12-14 09:58:43 +01:00
José Valim 8dbf96711e Preserve user's choice on operators, closes #8417 2018-11-25 23:01:53 +01:00
Michał Muskała f1015ebef9 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 127e35edf1 Update TODO notes 2018-10-29 19:04:19 +01:00
Fernando Tapia Rico 61052e412f Use imported function in elixir_parser.yrl (#8151) 2018-08-29 14:19:50 +02:00
José Valim 0e0deadb6c Do not allow atoms inside maps 2018-08-09 10:33:15 +02:00
José Valim 58540dd79a Only compute eol if necessary 2018-06-10 17:53:40 +02:00
Sihui Huang 36f7867a23 When fn is followed by a newline, use multi-clause formatting style (#7737) 2018-06-10 17:45:02 +02:00