Disallow duplicate type variable declarations

Closes PR 13416

Please merge to 5.3.2