Commit Graph
17 Commits
Author SHA1 Message Date
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 058c0eff66 Add Module.overridables_in/1, see #11145 2021-07-27 12:56:28 +02:00
Ioannis Pinakoulakis 367fc1cb34 Typos on the erlang files (#10118) 2020-06-21 11:14:11 +02:00
José Valim e80b55b21c Unify error handling and compiler deadlock checking (#9009) 2019-05-02 16:27:13 +02:00
Fernando Tapia Rico 03afdb0846 Do not allow to override macros as functions (#8816)
And vice-versa.

Overriding a macro as a function (and vice-versa) might produce
undesired effects.

For example, it's not clear if the following code should or
should not raise:

    defmodule Foo do
      def foo, do: bar()
      defmacro bar, do: :ok
      defoverridable bar: 0
      def bar, do: :ok
    end

On top of that, `super` does not currently work for such cases.
2019-02-23 09:08:16 +01:00
Fernando Tapia Rico cb5306bf98 Store overridable information more efficiently (#8799)
This is part of an ongoing effort to forbid overriding macros
with functions and vice-versa. New checks will require the
overridable information to be stored more efficiently.
2019-02-16 16:05:54 +01:00
José Valim f93d703979 Standardize more TODOs 2018-12-21 13:42:54 +01:00
Glauber Campinho 5b48933f47 Let the undefined function error be performed in Elixir-land (#8231)
Refers to #5800
2018-10-01 12:22:38 +02:00
José Valim 4580764ffa Do not include overridables in definitions, closes #7823 2018-07-03 12:39:58 +02:00
José Valim 12a4ea4c9f Add handle_continue/2 and deprecate super in GenServer callbacks 2018-06-20 23:53:55 +02:00
José Valim 74f3d36d4f Move accumulate attributes to a separate table (#7472)
We also speed up reading and writing of attributes via the @ macro.
2018-03-21 17:13:43 +01:00
José Valim 882e7b8af4 Share Bag and Set tables across a module functionality
Previously we kept a Set table for attributes and a Bag table
for function definitions and clauses. This led to suboptimal
usage of ets tables.

With this commit, we start using both Bag and Set tables
to store function/macro definition information. In the next
commits we will continue generalizing the tables, storing
specs, docs and accumulated attributes in the Bag and keep
the remaining functionality in Set.
2018-03-20 10:30:37 +01:00
José Valim d24cad38fb Add Code.Identifier to hold shared identifier logic throughout Elixir 2017-08-22 13:22:26 +02:00
José Valim a5ef4b5bd2 Properly track unreachable defmacrops in locals tracker 2017-07-28 12:48:26 +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
Sam Davies 3fe59919a8 Do not warn about missing @impl for overridable functions (#6098) 2017-05-11 19:49:01 +02:00
José Valim a722e6c18c More module renaming and organizing 2017-02-19 21:20:43 +01:00