Subtype test for expected type in `cast` is more accurate