Commit Graph
9735 Commits
Author SHA1 Message Date
José Valim de7abfeb4e Handle block and multiline clauses without line length 2021-12-11 10:19:06 +01:00
Andrea Leopardi f7cbee5e74 Export types in Module (#11464)
Export t:Module.definition/0 and t:Module.def_kind/0.

They are referenced throughout the documentation for Module
so it makes sense to expose them.
2021-12-11 07:33:39 +01:00
José Valim dabfc58780 Revert "Simplify inspect testing structure"
The particular error message requires OTP 24.

This reverts commit 7bac166dd4.
2021-12-10 13:09:42 +01:00
José Valim 6d00071883 Normalize important notes 2021-12-10 11:37:14 +01:00
José Valim 7bac166dd4 Simplify inspect testing structure 2021-12-10 11:13:54 +01:00
José Valim 382c6d2e0e Track environment changes from compile_env 2021-12-10 09:49:47 +01:00
José Valim 99006eb081 Do not cursor sigil after dot 2021-12-10 09:27:45 +01:00
felipe stival b13a9977d9 Change approach: never show error if line is empty (#11466) 2021-12-10 09:27:25 +01:00
José Valim e89bbdfb29 Handle improper lists on apply, closes #11465 2021-12-09 21:22:39 +01:00
José Valim 1a9e59cd4d Deprecate use Bitwise and ~~~
Use `import` instead.
2021-12-09 21:08:57 +01:00
Dorgan 2c8a9ddf53 Fix formatting of lists in module attribues (#11462) 2021-12-08 23:51:26 +01:00
José Valim 611139ef3e Fix codepoint byte counting in slice, closes #11461 2021-12-08 23:50:38 +01:00
Andrea Leopardi 6cd5e861fe Add deep-merge example in docs for Config.config/3 (#11458) 2021-12-08 10:12:39 +01:00
Chris Miller 5b8ccc55e4 Add Stream.duplicate/2 (#11456) 2021-12-07 20:42:56 +01:00
José Valim 2642226f35 Fix halt for --version 2021-12-07 08:35:17 +01:00
Zhe Cheng c633b532ab Remove doc repeat iex example for Date.end_of_week (#11454) 2021-12-07 08:24:25 +01:00
José Valim af0fd81606 Make sure --version flag halts elixir and iex, closes #11453 2021-12-07 08:18:19 +01:00
José Valim 853fd9b6b8 Only check for path as nil 2021-12-06 15:16:13 +01:00
José Valim aa41c88086 Do not deprecate URI.parse/1
Closes #11450.
2021-12-06 14:58:01 +01:00
José Valim 88bad1a3b0 Clarify summary for Keyword.validate/2 2021-12-06 11:29:33 +01:00
José Valim 822837e188 Add clarifications to Access error message 2021-12-05 20:20:37 +01:00
José Valim c329e71106 Mention Mix.install/2 on protocol consolidation 2021-12-05 19:52:33 +01:00
Parker Selbert 1f0422ac2e Specific base typespecs (#11449)
* Use specific options for base option typespecs

Each function had `keyword` as the option type, which didn't help guard
against typos or mismatched options.

* Fix padding use in encode/decode identity test
2021-12-05 19:50:22 +01:00
José Valim c4527b3ff4 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 74d61e0c8d Update macro.ex 2021-12-05 14:30:04 +01:00
Eksperimental 6f98831d88 Fix spec for Code.Identifier.escape/4 (#11445)
Closes #11444
2021-12-05 10:51:52 +01:00
José Valim 4dd1301d03 Warn on ::: to avoid ambiguity
The formatter already rewrote it to :"::" since
its conception.
2021-12-05 10:40:19 +01:00
Eksperimental 5bcd0bbce9 Colorize Version.Requirement source in Inspect protocol (#11441)
This is to avoid ambiguity in cases like

    iex> Version.parse_requirement!("~> 1.2.3 or < 3.4.5 and > 5.6.7")
    #Version.Requirement<~> 1.2.3 or < 3.4.5 and > 5.6.7>
2021-12-04 22:10:49 +01:00
Wojtek Mach 4204a0a1d1 Add missing @doc since (#11443) 2021-12-04 19:57:22 +01:00
Eksperimental 9e0e0fca56 Add guards and specs to Identifier.escape/4 (#11439) 2021-12-04 15:35:05 +01:00
Kian Meng Ang 4995e06713 Update code example for unquote/1 (#11437)
The output have changed since 1.13.0-rc.0.
2021-12-03 20:23:22 +01:00
José Valim 69fc6024aa Clarify docs for use/2 2021-12-03 19:48:51 +01:00
Benjamin Milde 0db4f426c7 Update microsecond typespec (#11436)
Show which part of the tuple is the value and which the precision
2021-12-03 18:34:54 +01:00
José Valim 6eb00ca7d2 Still document nil as part of the URI path, closes #11424 2021-12-02 23:23:54 +01:00
José Valim c2578c9370 Add Map.from_keys/2 and Keyword.from_keys/2 (#11432)
The map operation is optimized since Erlang/OTP 24+
as we don't need to do an additional traversal to
create tuples.
2021-12-02 21:51:22 +01:00
Dorgan 2dede8ea2b Fix normalization of kw list in blocks (#11431) 2021-12-02 08:21:59 +01:00
Michał Łępicki 0ff6522ab4 Fix opaque Version.Requirement usage (#11428)
Do not pattern match on internal opaque type structure
outside of the module with that opaque type definition.
Fixes related dialyzer issues.
2021-12-01 09:56:54 +01:00
felipe stival 31dd59dbd1 Add note in Float.to_{string/charlist}/1 (#11359) 2021-11-30 14:15:54 +01:00
Eksperimental a1e794fce5 Improve Version.compile_requirement/1 (#11427) 2021-11-30 11:25:19 +01:00
José Valim b131f87464 Warn if an outdated lexical tracker is given on eval 2021-11-26 23:00:18 +01:00
Moshe Paul def1b2bd1a Clarify documentation for Stream.transform/3 (#11419) 2021-11-26 21:02:51 +01:00
José Valim 3b93c6f969 Move syntax errors to parser file 2021-11-26 21:02:07 +01:00
José Valim adab68df21 Do not print control chars as unexpected tokens 2021-11-26 21:02:07 +01:00
Eric Meadows-Jönsson 0fd981a498 Add Version.to_string/1 (#11422) 2021-11-26 15:38:52 +01:00
José Valim 209688fc52 Handle outdated anonymous functions in Erlang/OTP 25 (#11421) 2021-11-26 06:47:10 +01:00
José Valim cc877ee16b 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 f5208a39a3 Emit checker warnings on compile_string/compile_quoted, closes #11417 2021-11-25 21:14:14 +01:00
José Valim 4a88be86f8 Preserve opts while formatting failed inspect struct
Also make formatting consistent.
2021-11-25 18:11:05 +01:00
Eksperimental 6fa5018f9e Improve user experience when there is a faulty Inspect implementation (#11403) 2021-11-25 17:41:03 +01:00
José Valim 5851879430 Update CHANGELOG 2021-11-23 14:31:19 +01:00