Adds subtyping for filters.

Closes PR 12817.