ATS2: Unleashing the Potentials of Types and Templates