Factored out some common code used to record/variant type annotations