I can't figure out what's calling isEmpty

I’m practicing with a BitArray type. I’m going to add an optimized implementation of Collection.isEmpty. Before writing specific tests, I ran my current ones and my override got accessed 3 times. I can’t figure out what’s calling it; I wrote my internal implementations to avoid calling isEmpty and count. I searched my type’s code, my test code, and the Collection source files at Apple’s Swift’s GitHub site. I did just upload the code if anyone wants to take a look.

I thought it was BidirectionalCollection.last, but I use it just twice in my tests. Even if it matches, where’s the last call from?

Why don’t you put a breakpoint on it and look at the stack trace?

reverse is the other method that somehow calls isEmpty. (I still haven’t found the source code for some StdLib methods.)

If you’re using Xcode then you can execute a right click onto your identifier and then click on Find Call Hierarchy, this will save you lots of time figuring out how some foreign API works and where is it used/called from (assuming you have access to the call-side).