Index: src/SymTab/Mangler.cc
===================================================================
--- src/SymTab/Mangler.cc	(revision 9749d2fa5f42410d163813e570aefa765780a498)
+++ src/SymTab/Mangler.cc	(revision 42b739d7d8a375532eac77b64b9324a9be21fb17)
@@ -439,5 +439,5 @@
 		  private:
 			void mangleDecl( const ast::DeclWithType *declaration );
-			void mangleRef( const ast::BaseInstType *refType, std::string prefix );
+			void mangleRef( const ast::BaseInstType *refType, const std::string & prefix );
 
 			void printQualifiers( const ast::Type *type );
@@ -535,12 +535,4 @@
 		}
 
-		__attribute__((unused))
-		inline std::vector< ast::ptr< ast::Type > > getTypes( const std::vector< ast::ptr< ast::DeclWithType > > & decls ) {
-			std::vector< ast::ptr< ast::Type > > ret;
-			std::transform( decls.begin(), decls.end(), std::back_inserter( ret ),
-							std::mem_fun( &ast::DeclWithType::get_type ) );
-			return ret;
-		}
-
 		void Mangler_new::postvisit( const ast::FunctionType * functionType ) {
 			printQualifiers( functionType );
@@ -558,19 +550,18 @@
 		}
 
-		void Mangler_new::mangleRef( const ast::BaseInstType * refType, std::string prefix ) {
+		void Mangler_new::mangleRef(
+				const ast::BaseInstType * refType, const std::string & prefix ) {
 			printQualifiers( refType );
 
 			mangleName += prefix + std::to_string( refType->name.length() ) + refType->name;
 
-			if ( mangleGenericParams ) {
-				if ( ! refType->params.empty() ) {
-					mangleName += "_";
-					for ( const ast::Expr * param : refType->params ) {
-						auto paramType = dynamic_cast< const ast::TypeExpr * >( param );
-						assertf(paramType, "Aggregate parameters should be type expressions: %s", toCString(param));
-						maybeAccept( paramType->type.get(), *visitor );
-					}
-					mangleName += "_";
+			if ( mangleGenericParams && ! refType->params.empty() ) {
+				mangleName += "_";
+				for ( const ast::Expr * param : refType->params ) {
+					auto paramType = dynamic_cast< const ast::TypeExpr * >( param );
+					assertf(paramType, "Aggregate parameters should be type expressions: %s", toCString(param));
+					maybeAccept( paramType->type.get(), *visitor );
 				}
+				mangleName += "_";
 			}
 		}
@@ -656,4 +647,5 @@
 		}
 
+		// For debugging:
 		__attribute__((unused)) void printVarMap( const std::map< std::string, std::pair< int, int > > &varMap, std::ostream &os ) {
 			for ( std::map< std::string, std::pair< int, int > >::const_iterator i = varMap.begin(); i != varMap.end(); ++i ) {
@@ -665,36 +657,34 @@
 			// skip if not including qualifiers
 			if ( typeMode ) return;
-			if ( auto ptype = dynamic_cast< const ast::FunctionType * >(type) ) {
-				if ( ! ptype->forall.empty() ) {
-					std::list< std::string > assertionNames;
-					int dcount = 0, fcount = 0, vcount = 0, acount = 0;
-					mangleName += Encoding::forall;
-					for ( auto & decl : ptype->forall ) {
-						switch ( decl->kind ) {
-						  case ast::TypeDecl::Kind::Dtype:
-							dcount++;
-							break;
-						  case ast::TypeDecl::Kind::Ftype:
-							fcount++;
-							break;
-						  case ast::TypeDecl::Kind::Ttype:
-							vcount++;
-							break;
-						  default:
-							assertf( false, "unimplemented kind for type variable %s", SymTab::Mangler::Encoding::typeVariables[decl->kind].c_str() );
-						} // switch
-						varNums[ decl->name ] = std::make_pair( nextVarNum, (int)decl->kind );
-					} // for
-					for ( auto & assert : ptype->assertions ) {
-						assertionNames.push_back( ast::Pass<Mangler_new>::read(
-							assert->var.get(),
-							mangleOverridable, typeMode, mangleGenericParams, nextVarNum, varNums ) );
-						acount++;
-					} // for
-					mangleName += std::to_string( dcount ) + "_" + std::to_string( fcount ) + "_" + std::to_string( vcount ) + "_" + std::to_string( acount ) + "_";
-					for(const auto & a : assertionNames) mangleName += a;
-//					std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) );
-					mangleName += "_";
-				} // if
+			auto funcType = dynamic_cast<const ast::FunctionType *>( type );
+			if ( funcType && !funcType->forall.empty() ) {
+				std::list< std::string > assertionNames;
+				int dcount = 0, fcount = 0, vcount = 0, acount = 0;
+				mangleName += Encoding::forall;
+				for ( auto & decl : funcType->forall ) {
+					switch ( decl->kind ) {
+					case ast::TypeDecl::Dtype:
+						dcount++;
+						break;
+					case ast::TypeDecl::Ftype:
+						fcount++;
+						break;
+					case ast::TypeDecl::Ttype:
+						vcount++;
+						break;
+					default:
+						assertf( false, "unimplemented kind for type variable %s", SymTab::Mangler::Encoding::typeVariables[decl->kind].c_str() );
+					} // switch
+					varNums[ decl->name ] = std::make_pair( nextVarNum, (int)decl->kind );
+				} // for
+				for ( auto & assert : funcType->assertions ) {
+					assertionNames.push_back( ast::Pass<Mangler_new>::read(
+						assert->var.get(),
+						mangleOverridable, typeMode, mangleGenericParams, nextVarNum, varNums ) );
+					acount++;
+				} // for
+				mangleName += std::to_string( dcount ) + "_" + std::to_string( fcount ) + "_" + std::to_string( vcount ) + "_" + std::to_string( acount ) + "_";
+				for ( const auto & a : assertionNames ) mangleName += a;
+				mangleName += "_";
 			} // if
 			if ( ! inFunctionType ) {
