Closed arconautishche closed 2 years ago
@arconautishche Good find, there's a bug 👀. This comment is produced when the analyzer thinks you didn't use Kernel.get_in
in BasketballWebsite.get_in_path
. Unfortunately it only detects get_in
used without the module name prefix. We definitely don't want to tell people to remove the module name prefix from the function call, both ways of calling the function are valid.
Our custom macro assert_call
is already able to handle the fact that Kernel
gets autoimported. We just used it a bit wrong in the analysis for BasketballWebsite - we didn't specify that get_in
comes from the Kernel
module so it's treated as any other local function. The fix for this problem would be as easy as going to the file lib/elixir_analyzer/test_suite/basketball_website.ex
and changing two identical lines of code like this:
# before
called_fn name: :get_in
# after
called_fn module: Kernel, name: :get_in
Adding an extra test to make sure that both calls with and without Kernel
are valid would also be great.
@arconautishche Would you want to open a PR with those changes?
Thanks for the detailed explanation, @angelikatyborska! I will try to make a PR soon.
I'm getting the following warning if I prefix
get_in(...)
withKernel
:I'm not sure if this is a mistake or just a matter of wording. Maybe the idea was to say you do not need to prefix Kernel functions with
Kernel
?This code produces the warning:
and this does not: