Index: src/SymTab/Mangler.cc
===================================================================
--- src/SymTab/Mangler.cc	(revision 04c7779177abc8406a5ca4096b6a829b176215c3)
+++ src/SymTab/Mangler.cc	(revision 0e761e405c325b38ae1fc9d3ac70a15a9a693bc5)
@@ -240,6 +240,11 @@
 				} else {
 					printQualifiers( typeInst );
+					// Note: Can't use name here, since type variable names do not actually disambiguate a function, e.g.
+					//   forall(dtype T) void f(T);
+					//   forall(dtype S) void f(S);
+					// are equivalent and should mangle the same way. This is accomplished by numbering the type variables when they
+					// are first found and prefixing with the appropriate encoding for the type class.
 					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;
+					mangleName << Encoding::typeVariables[varNum->second.second] << varNum->second.first;
 				} // if
 			}
@@ -287,4 +292,10 @@
 
 			void Mangler::postvisit( TypeDecl * decl ) {
+				// TODO: is there any case where mangling a TypeDecl makes sense? If so, this code needs to be
+				// fixed to ensure that two TypeDecls mangle to the same name when they are the same type and vice versa.
+				// Note: The current scheme may already work correctly for this case, I have not thought about this deeply
+				// and the case has not yet come up in practice. Alternatively, if not then this code can be removed
+				// aside from the assert false.
+				assertf(false, "Mangler should not visit typedecl: %s", toCString(decl));
 				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;
