Index: src/SymTab/Mangler.cc
===================================================================
--- src/SymTab/Mangler.cc	(revision 38587bc15ccc31dd244fe746adf78d711211344a)
+++ src/SymTab/Mangler.cc	(revision 0e73845c79836fc811677075d13e2a1858071a38)
@@ -149,5 +149,5 @@
 			void Mangler::postvisit( BasicType * basicType ) {
 				printQualifiers( basicType );
-				assert( basicType->get_kind() < BasicType::NUMBER_OF_BASIC_TYPES );
+				assertf( basicType->get_kind() < BasicType::NUMBER_OF_BASIC_TYPES, "Unhandled basic type: %d", basicType->get_kind() );
 				mangleName << Encoding::basicTypes[ basicType->get_kind() ];
 			}
@@ -240,20 +240,6 @@
 				} else {
 					printQualifiers( typeInst );
-					std::ostringstream numStream;
-					numStream << varNum->second.first;
-					switch ( (TypeDecl::Kind )varNum->second.second ) {
-					  case TypeDecl::Dtype:
-						mangleName << "d";
-						break;
-					  case TypeDecl::Ftype:
-						mangleName << "f";
-						break;
-						case TypeDecl::Ttype:
-						mangleName << "tVARGS";
-						break;
-						default:
-						assert( false );
-					} // switch
-					mangleName << numStream.str();
+					assertf( varNum->second.second < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", varNum->second.second );
+					mangleName << Encoding::typeVariables[varNum->second.second] << typeInst->get_name().size() << typeInst->get_name(); // varNum->second.first;
 				} // if
 			}
@@ -301,6 +287,6 @@
 
 			void Mangler::postvisit( TypeDecl * decl ) {
-				static const char *typePrefix[] = { "BT", "BD", "BF" };
-				mangleName << typePrefix[ decl->get_kind() ] << ( decl->name.length() + 1 ) << decl->name;
+				assertf( decl->get_kind() < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", decl->get_kind() );
+				mangleName << Encoding::typeVariables[ decl->get_kind() ] << ( decl->name.length() ) << decl->name;
 			}
 
@@ -316,6 +302,6 @@
 				if ( ! type->get_forall().empty() ) {
 					std::list< std::string > assertionNames;
-					int tcount = 0, dcount = 0, fcount = 0, vcount = 0;
-					mangleName << "A";
+					int dcount = 0, fcount = 0, vcount = 0, acount = 0;
+					mangleName << Encoding::forall;
 					for ( Type::ForallList::iterator i = type->forall.begin(); i != type->forall.end(); ++i ) {
 						switch ( (*i)->get_kind() ) {
@@ -340,7 +326,8 @@
 							(*assert)->accept( sub_mangler );
 							assertionNames.push_back( sub_mangler.pass.mangleName.str() );
+							acount++;
 						} // for
 					} // for
-					mangleName << tcount << "_" << dcount << "_" << fcount << "_" << vcount << "_";
+					mangleName << dcount << "_" << fcount << "_" << vcount << "_" << acount << "_";
 					std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) );
 					mangleName << "_";
Index: src/SymTab/Mangler.h
===================================================================
--- src/SymTab/Mangler.h	(revision 38587bc15ccc31dd244fe746adf78d711211344a)
+++ src/SymTab/Mangler.h	(revision 0e73845c79836fc811677075d13e2a1858071a38)
@@ -57,4 +57,7 @@
 			extern const std::string qualifiedTypeEnd;
 
+			extern const std::string forall;
+			extern const std::string typeVariables[];
+
 			extern const std::string struct_t;
 			extern const std::string union_t;
Index: src/SymTab/ManglerCommon.cc
===================================================================
--- src/SymTab/ManglerCommon.cc	(revision 38587bc15ccc31dd244fe746adf78d711211344a)
+++ src/SymTab/ManglerCommon.cc	(revision 0e73845c79836fc811677075d13e2a1858071a38)
@@ -16,4 +16,5 @@
 #include "Mangler.h"
 #include "SynTree/Type.h"
+#include "SynTree/Declaration.h"
 
 namespace SymTab {
@@ -82,4 +83,15 @@
 			const std::string qualifiedTypeEnd = "E";
 
+			const std::string forall = "Q";
+			const std::string typeVariables[] = {
+				"BD", // dtype
+				"BF", // ftype
+				"BT", // ttype
+			};
+			static_assert(
+				sizeof(typeVariables)/sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS,
+				"Each type variable kind should have a corresponding mangler prefix"
+			);
+
 			const std::string struct_t = "S";
 			const std::string union_t = "U";
