Closed Couto closed 6 years ago
Thanks for the report! I'm looking into this and I'll follow up when I have a concrete plan.
The Problem:
In order to count references, the current implementation has lists of references that it walks and counts up the matches. When I noticed the algorithm collecting up tons of references to String
, Int
, etc., I implemented a blacklist on many auto-imported types and functions, figuring they didn't need to be counted: https://github.com/mbuscemi/elm-lens/blob/master/elm/src/ElmFile/References.elm#L151.
It looks like I didn't appropriately anticipate actual usage.
Solution: I implemented the list approach to reference counting because it was quick, but I'm going to move to a dictionary implementation, which will obviate the blacklist. That should fix this issue. I'll make this work part of 0.2.0.
Thanks again, @Couto!
Thanks a lot for the update explaining the problem! That's pretty cool! 👍
Encountered the same issue when using this on the elm-analyse
code base. Great, that is already reported +1.
This should be fixed in the 0.2.0 branch.
@Couto @stil4m Can you please confirm that this is fixed for you in v0.2.0?
Tested in 0.2.0 and it is fixed 👍
@mbuscemi I can also confirm that this is fixed (at least for my use cases)! 👍
Thanks for your work! 🥇
Verified fixed.
This happens consistently in at least two projects.
I'm not an expert in Elm, but I believe that is probably because is doing some confusion with
Platform.Task
You can see the source code in action in this ellie: https://ellie-app.com/cvmGqQdtda1/0
If I rename
Task
toTaskItem
per example, the reference count becomes correct: