Correctly consider identifiers introduced by outer list comprehension when planning pattern predicates