Hi!
I recently found a nasty bug that was really hard to spot. What happened was that the code had a list with a .forEach{} call like this:
introAnimationViews.forEach { visibility = View.INVISIBLE }
when it was supposed to do:
introAnimationViews.forEach { it.visibility = View.INVISIBLE }
We wasted too much time on such a simple bug I would like to propose there should be a compile error for this when “it” is not used in a .forEach{} since it doesn’t make any sense to iterate on a list without actually doing anything with its content.
I also checked with a colleague Swift developer and it seems Swift is giving a compile error for this scenario which I think is a proper safe guard for developers.
Sounds like a good idea?