Support `isinstance` constraints in inference (#2846)

6 files changed