Index: src/GenPoly/GenPoly.cc
===================================================================
--- src/GenPoly/GenPoly.cc	(revision 361bf012e550db91b38f772bfbc7cb7ed2e49033)
+++ src/GenPoly/GenPoly.cc	(revision 852ae0eadf725a60480bf20abd6249d378714821)
@@ -115,5 +115,5 @@
 		if (!env) return type;
 		if (auto typeInst = dynamic_cast<const ast::TypeInstType*> (type)) {
-			auto newType = env->lookup(typeInst->name);
+			auto newType = env->lookup(typeInst);
 			if (newType) return newType;
 		}
@@ -172,5 +172,5 @@
 
 		if ( auto typeInst = dynamic_cast< const ast::TypeInstType * >( type ) ) {
-			return tyVars.find(typeInst->name) != tyVars.end() ? type : nullptr;
+			return tyVars.find(typeInst->typeString()) != tyVars.end() ? type : nullptr;
 		} else if ( auto arrayType = dynamic_cast< const ast::ArrayType * >( type ) ) {
 			return isPolyType( arrayType->base, env );
@@ -552,6 +552,6 @@
 	}
 
-	void addToTyVarMap( const ast::TypeDecl * tyVar, TyVarMap & tyVarMap) {
-		tyVarMap.insert(tyVar->name, convData(ast::TypeDecl::Data{tyVar}));
+	void addToTyVarMap( const ast::TypeInstType * tyVar, TyVarMap & tyVarMap) {
+		tyVarMap.insert(tyVar->typeString(), convData(ast::TypeDecl::Data{tyVar->base}));
 	}
 
