Commit Graph
43 Commits
Author SHA1 Message Date
José Valim 7d9c531519 Ensure that keyword: (... -> ...) can be encoded back, closes #14267 2025-02-20 06:10:35 +01:00
Jonatan Männchen f7bbe81ea7 Inline licence info & copyright for test files (#14257) 2025-02-07 20:54:14 +01:00
Jean Klingler cc68ad91cb Add shallow validation when unquoting AST (#13950) 2024-11-03 17:20:33 +09:00
José Valim 09d43562e7 Fix edge case in normalizer for keyword args (#13924)
Closes #13895.
Closes #13916.
2024-10-22 16:56:01 +02:00
Jean Klingler 673fe4a893 Fix crash in Macro.to_string/1 on invalid sigils (#13905) 2024-10-17 15:38:49 +09:00
José Valim e2556fd478 Clarify behaviour of Macro.to_string on invalid ASTs
Closes #13875.
2024-10-02 08:48:49 +02:00
Jean Klingler 5eddb4bbfe Rework migrate options for the formatter (#13841) 2024-09-20 17:34:59 +09:00
Jean Klingler bc50d94943 Fix Code.Normalizer for keyword operand with :do key (#13250) 2024-01-13 17:58:45 +09:00
José Valim a48c2d5dd2 Remove deprecated code and add TODOs 2023-11-14 00:51:34 +01:00
José Valim 65ffb5db92 Handle error in Macro.to_string/1, closes #13102 2023-11-14 00:51:12 +01:00
José Valim 08e02cff84 Do not loop when invalid block is given to formatter, closes #12922 2023-09-13 09:49:56 +02:00
Zach Allaun f91a0ff770 Code.Normalizer: Use correct meta fields in normalize_call/2 (#12389) 2023-02-09 22:43:22 +01:00
José Valim bf708737d3 Handle false positive on List.to_charlist/1 formatting, closes #12248 2022-11-17 20:13:13 +01:00
José Valim 0a1a5991d9 Remove unecessary parens in nullary type funs 2022-10-14 13:55:23 +02:00
sabiwara 1d0100e394 Fix algebra edge case on :erlang.binary_to_atom/2 (#12163) 2022-10-02 23:32:31 +02:00
sabiwara 239ae0877a Handle syntax_colors in quoted_to_algebra and dbg (#12106) 2022-09-04 15:10:22 +02:00
José Valim 7a8e5f1d05 Fix module attribute with empty list in Macro.to_string, closes #12097 2022-08-26 08:56:20 +02:00
sabiwara 29bf449f3f Evaluate formating charlists as ~c sigils (#12064) 2022-08-10 06:47:00 +02:00
Eksperimental 00ba30babd Fix bug with edge-case when converting to algebra quoted Elixir alias (#11572)
The following code would crash:

    iex> Code.quoted_to_algebra(Elixir)
    ** (MatchError) no match of right hand side value: "Elixir"
        (elixir 1.13.1) lib/code/normalizer.ex:254: Code.Normalizer.normalize_literal/3
        (elixir 1.13.1) lib/code.ex:1107: Code.quoted_to_algebra/2

Therefore, this as well:

    iex> Macro.to_string(Elixir)
    ** (MatchError) no match of right hand side value: "Elixir"
        (elixir 1.13.1) lib/code/normalizer.ex:254: Code.Normalizer.normalize_literal/3
        (elixir 1.13.1) lib/code.ex:1107: Code.quoted_to_algebra/2
        (elixir 1.13.1) lib/macro.ex:948: Macro.to_string/1
2022-01-16 09:28:09 +01:00
Dorgan 33a9907cca Fix formatting of lists in module attribues (#11462) 2021-12-08 23:51:26 +01:00
Dorgan 99bae51b26 Fix normalization of kw list in blocks (#11431) 2021-12-02 08:21:59 +01:00
Dorgan 9b02691b46 Fix normalizer not preserving user choice on module attribute lists (#11397) 2021-11-17 15:05:37 +01:00
José Valim b6508a6a13 Do not raise on variable looking like an empty tuple 2021-11-13 12:37:01 +01:00
José Valim 63a5270435 Do not extract comments without a newline 2021-11-08 18:01:25 +01:00
José Valim 458b74a5d4 Use keyword syntax by default in tuple formatting 2021-11-08 17:25:25 +01:00
Dorgan b45fb0efd0 Keep keyword format of tuple last element (#11354) 2021-10-31 22:26:59 +01:00
José Valim 1f365d6c50 Properly normalize multiple args keyword list 2021-08-25 12:17:41 +02:00
José Valim 893f86a3b4 Check map ast actually contain args 2021-07-22 11:54:58 +02:00
Dorgan e075b4bb77 Fix normalization of partial keyword list elements (#11084) 2021-06-23 19:38:25 +02:00
Dorgan 7fbe2ae120 Preserve user choice on parenthesis before do block (#11061) 2021-06-11 21:36:15 +02:00
José Valim f4fa14c417 Accept :locals_without_parens in Code.quoted_to_algebra/2 2021-05-27 14:31:07 +02:00
José Valim 541ce6eb9d Wrap all invalid nodes in normalizer 2021-05-27 14:06:30 +02:00
José Valim b44bbe536c Do not assume that literals in blocks have been normalized 2021-05-27 13:15:46 +02:00
Dorgan 689bb36dab Prevent 2-tuples from being normalized twice (#11007) 2021-05-25 20:31:07 +02:00
Dorgan e9627afb71 Preserve metadata on regular blocks (#11004) 2021-05-25 09:02:22 +02:00
José Valim 97ba4c4839 Use Code.quoted_to_algebra on Macro.to_string (#11003) 2021-05-24 16:00:57 +02:00
José Valim 57b7d9df1c More fixes on normalizer 2021-05-24 11:03:07 +02:00
José Valim 2d1c64cc5d Do not assume delimiter is always available for sigils 2021-05-24 09:42:25 +02:00
José Valim 1ed4515f5f Run formatter 2021-05-24 09:19:29 +02:00
José Valim 5dda474035 More fixes for quoted_to_algebra/2 2021-05-24 09:18:49 +02:00
Dorgan 69ac9a7586 Fix ast normalizing issue with keyword lists (#11002) 2021-05-24 08:56:36 +02:00
José Valim 9176be6437 Reorganize code normalizer tests 2021-05-23 21:55:30 +02:00
Dorgan 634db9e963 Expose more formatter functions in the Code module (#10988) 2021-05-23 21:27:37 +02:00