Closed angelikatyborska closed 1 year ago
@jiegillet I need your help here. I can't get the last two tests from this commit to pass: https://github.com/exercism/elixir-analyzer/commit/40ad1679bd4eac1634edb3fc5371e206ceedd8e6
I am very confused about how assert_call
compiler works. Somehow it looks for the right function call twice, once in a find
function, and then again in indirect_call?
? Is that right? And indirect_call?
doesn't seem to use modules_in_scope
at all, where the alias information is stored. Why?
Man, it's been a while :)
Yes, it's right, it's looking for the function call twice, but the second time seems to be very lacking. Your approach was great and should have worked.
I think we should refactor so that the first pass with find
finds the function call leaves a tag in the metadata if it finds it, and then the second pass with indirect_call?
can find it it's called in the right place. I will try to find the time to do that this week :)
OK, I think I found a solution. It took me a while to remember how this all works.
There were two issues:
track_all_functions
usually doesn't need to know about aliases, because when function_def?
finds a match, it is added to the tree directly with a de-aliased module. However, that breaks down when the call is in a different module that is aliased.function_def?
wouldn't detect the function call in defdelegate
, leaving it to the very limited track_all_functions
So I made the following changes:
track_all_functions
the list of all aliasestrack_all_functions
in annotate_and_find
to make sure the list of aliases is completedefdelegate
into def
that function_def?
can analyzeWoohoo! Thank you 🙏 all the tests are passing now
Resolves https://github.com/exercism/elixir-analyzer/issues/296