Support type narrowing when if condition contains isinstance check