Implement accepts_type handling.

This is the primitive that makes things like subset types work.