What is an example of an empty selection that has a $cursor?

I’m trying to understand this line of code:

if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType)) return false

Here’s what the reference says about $cursor:

Returns a resolved position if this is a cursor selection (an empty text selection), and null otherwise.

So, if a selection is empty, doesn’t it always have a $cursor? Why test for this? I’m guessing this is for cases of non-text or non-inline nodes. But wouldn’t that be covered in that markApplies() call that follows?

Only if it is a TextSelection. I think with the default selection classes, you could only get an empty selection without a cursor if the document is entirely empty (which most schemas don’t allow, but an inline-only schema would) and you create an AllSelection, but custom selection classes could also make this possible in more common scenarios.