A question about multi-queries

I have the following code:

($Viewer can see $Object)
        (if) (bound $Viewer) (then)
                (animate $Viewer)
                ($Viewer has ancestor $Room)
                (room $Room)
                ($Object has ancestor $Room)
        (else)
                ($Object has ancestor $Room)
                (room $Room)
                ($Viewer has ancestor $Room)
                (animate $Viewer)
        (endif)
        (visibility ceiling of $Viewer is $Ceil)
        (light reaches ceiling $Ceil)
        (visibility ceiling of $Object is $Ceil)

I test it with this code:

(after [look])
        (line)
        Test 1:
        (collect $O)
                *(#player can see $O)
        (into $Test1)
        #player can see $Test1
        (line)
        Test 2:
        (collect $O)
                *($O has ancestor #room)
                (#player can see $O)
        (into $Test2)
        #player can see $Test2

#room
(room *)

#player
(current player *)
(animate *)
(* is #in #room)

#hat
(wearable *)
(* is #wornby #player)

#apple
(item *)
(* is #in #room)

I am very confused why Test1 results in #player can see [#player], but Test2 results in #player can see [#player #hat #apple]. Shouldn’t Test1 result in *(#player can see $Object) trying every possible object and filtering out all but the ones #player can see? What is the right way to do the ($Viewer can see $Object) query so you can get all objects a viewer can see, as well as all viewers that can see an object?

Thank you for your time.