Index: src/SynTree/TypeSubstitution.cc
===================================================================
--- src/SynTree/TypeSubstitution.cc	(revision 61802744b2d902f9f63f386e3ef6840292ea6bbc)
+++ src/SynTree/TypeSubstitution.cc	(revision 51b858208ac4ba1dd63af02aa6f808536839b22a)
@@ -146,4 +146,12 @@
 }
 
+static bool are_same( TypeInstType * left, TypeInstType * right ) {
+	if ( left->baseType && right->baseType ) {
+		return left->baseType == right->baseType;
+	} else {
+		return left->name == right->name;
+	}
+}
+
 Type * TypeSubstitution::Substituter::postmutate( TypeInstType *inst ) {
 	BoundVarsType::const_iterator bound = boundVars.find( inst->name );
@@ -158,5 +166,5 @@
 		// TODO: investigate preventing type variables from being bound to themselves in the first place.
 		if ( TypeInstType * replacement = dynamic_cast< TypeInstType * >( i->second ) ) {
-			if ( inst->name == replacement->name ) {
+			if ( are_same( inst, replacement ) ) {
 				return inst;
 			}
