Typechecking Dependent Types and Subtypes