#5800 Behaviour Lint

28 views
Skip to first unread message

Alexis Brodeur

unread,
Oct 5, 2017, 8:54:13 PM10/5/17
to elixir-lang-core
I'm trying to work in moving the behaviour lint checks into Elixir as per #5800.

Since module attributes are not expanded at compile time by the compiler in elixir_expand.erl, I am at a road block as to where to implement the lint checks.

From what I gather, attributes are persisted at compile time in ETS and fetched during the compilation phase in elixir_module:compile, and are then converted to AST by the elixir_erl:attributes_form function.

Alexis Brodeur

unread,
Oct 5, 2017, 11:29:20 PM10/5/17
to elixir-lang-core
After a bit of thinking, I would obviously implement the checks after the expansion phase, since macros may define behaviour and callbacks, but should I do this check before the *:elixir_erl.attributes_form/3* function, or should I do it on the *Elixir* side in the *Elixir.Module.check_behaviours_and_impls/4* function ?
I would personally go for the latter, but I am more inclined to follow suggestions from more experienced contributors.

José Valim

unread,
Oct 6, 2017, 1:56:06 AM10/6/17
to elixir-l...@googlegroups.com
Yes, check_behaviours_and_impls is the way to go! It was named planning exactly for this case. Once you start working on there, you will notice part of the code already computes the callbacks from behaviours so we should avoid computing those things twice. So basically, we would get the behaviour data, validate it, and then check the implementations.

Notice also that once you move the warning to Elixir, you will need to add clauses to elixir_erl_compiler:handle_file_warning to make sure the warning is not printed twice: once by Elixir, another one by Erlang. 

PS: Discussions related to issues can be kept in the issues themselves. :)



José Valim
Founder and 
Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/4dd1b207-0040-402b-a8c7-8c2bc97a2f7c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages