Conversation
| unquote(stack), unquote(line)) | ||
|
|
||
| :lists.member(name, [:moduledoc, :typedoc, :doc]) -> | ||
| :lists.member(name, [:moduledoc, :typedoc, :doc, :impl]) -> |
There was a problem hiding this comment.
It is better to not rely on the line number. That's not a general feature of Elixir module attributes and as such it should be relied on very rarely.
|
According to the build it is working: https://travis-ci.org/elixir-lang/elixir/jobs/224857673#L237 It is just failing elsewhere inside the |
|
@josevalim This is about as far as I can go on my own before getting feedback, would you mind taking a look? |
d28bb2b to
3eb8621
Compare
There was a problem hiding this comment.
Perhaps we should actually raise instead of warn here?
There was a problem hiding this comment.
@josevalim The original proposal specified an @impl true variant but I actually prefer the explicitness of @impl Module and think we should enforce this form.
Perhaps we could ship the @impl Module specific case and see how people like it. If it seems obvious that @impl true would be nice to have in addition, we can easily add it later. Conversely, adding it now and removing it later would be much more difficult.
There was a problem hiding this comment.
@samphilipd I am already decided on making @impl true part of the implementation so we should go ahead with it.
d5e7e3e to
1764f8d
Compare
There was a problem hiding this comment.
Please use pattern matching to extract line, file, module and others out.
%{module: module, line: line, file: file} = env
There was a problem hiding this comment.
Why would we need to change store_typespec? :)
There was a problem hiding this comment.
You are correct. It's not necessary.
There was a problem hiding this comment.
For internal attributes, such as :impl_required, you can namespace it as{:elixir, :impl_required} to avoid conflicts with user attributes.
There was a problem hiding this comment.
Nothing. :) This is during bootstrap, so we don't care. If there are warnings, the modules will be recompiled after bootstrap, so we get them anyway.
There was a problem hiding this comment.
Can you please send those changes in another PR? :)
|
@josevalim I addressed your comments, this is ready for a second round of feedback. |
There was a problem hiding this comment.
There's probably room for refactoring here and combining logic between msg_impl_true_but_function_is_not_callback and msg_impl_behaviour_but_function_is_not_callback
There was a problem hiding this comment.
This test doesn't work. Is there another way to get the @doc of a module?
There was a problem hiding this comment.
This should always be a warning rather than an outright ArgumentError?
There was a problem hiding this comment.
It might make sense to merge this somehow with the true case since they both duplicate this callbacks_with_behaviour logic.
There was a problem hiding this comment.
This to_sentence function seems a bit too much for Module, but I couldn't think of another way to nicely present the warnings.
0924fcf to
db5186c
Compare
|
@josevalim OK I'm fairly happy with this, only two questions:
|
82b8235 to
078fdbd
Compare
03fc3ce to
960d503
Compare
|
@josevalim just a polite nudge for a review on this :) |
960d503 to
5d01187
Compare
|
|
||
| You may pass either `false`, `true`, or a specific behaviour to `@impl`. | ||
|
|
||
| defmodule Foo do |
There was a problem hiding this comment.
Please indent with four spaces.
|
Thank you @samphilipd! I will merge it locally and tidy up what is left. :) |
|
This has been merged and push to master. In order for the last test to pass, we had to change when the check happens, and this one done in a another commit: 92e5d04 Thank you so much! ❤️ 💚 💙 💛 💜 |
Implement @impl directive