Index: .gitignore
===================================================================
--- .gitignore	(revision 0f19d763a07f96324b450e9bafd7fdd52807ea0f)
+++ .gitignore	(revision eb50842f528b3e34cf566df4d08aa8c6d4b077a8)
@@ -1,28 +1,30 @@
+# build files
+*.[ado]
+
+# generated by configure
 Makefile
-autom4te.cache/
+aclocal.m4
+autom4te.cache
 config.h
+config.status
 config.log
-config.status
+stamp-h1
 driver/Makefile
+libcfa/Makefile
+src/Makefile
+
+# build directories
+bin
+lib
+
+# src executables, for lib and bin
 driver/cc1
-driver/cc1.o
 driver/cfa
-driver/cfa.o
-libcfa/Makefile
-libcfa/builtins.c
-libcfa/builtins.cf
+src/cfa-cpp
 libcfa/libcfa-prelude.c
-libcfa/libcfa-prelude.o
-libcfa/libcfa.a
-src/*/*.d
-src/*/*.o
-src/MakeLibCfa.d
-src/MakeLibCfa.o
+
+# generated by bison and lex from cfa.y and lex.l, respectively
 src/Parser/cfa.output
 src/Parser/cfa.tab.cc
 src/Parser/cfa.tab.h
 src/Parser/lex.yy.cc
-src/cfa-cpp
-src/main.d
-src/main.o
-stamp-h1
Index: src/ResolvExpr/FindOpenVars.h
===================================================================
--- src/ResolvExpr/FindOpenVars.h	(revision 0f19d763a07f96324b450e9bafd7fdd52807ea0f)
+++ src/ResolvExpr/FindOpenVars.h	(revision eb50842f528b3e34cf566df4d08aa8c6d4b077a8)
@@ -21,4 +21,5 @@
 
 namespace ResolvExpr {
+	// Updates open and closed variables and their associated assertions
 	void findOpenVars( Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen );
 } // namespace ResolvExpr
Index: src/ResolvExpr/Unify.cc
===================================================================
--- src/ResolvExpr/Unify.cc	(revision 0f19d763a07f96324b450e9bafd7fdd52807ea0f)
+++ src/ResolvExpr/Unify.cc	(revision eb50842f528b3e34cf566df4d08aa8c6d4b077a8)
@@ -73,4 +73,6 @@
 	};
 
+	/// Attempts an inexact unification of type1 and type2.
+	/// Returns false if no such unification; if the types can be unified, sets common (unless they unify exactly and have identical type qualifiers)
 	bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer, Type *&common );
 	bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
@@ -148,5 +150,7 @@
 			if ( curClass.type ) {
 				Type *common = 0;
+				// attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
 				std::auto_ptr< Type > newType( curClass.type->clone() );
+				newType->get_qualifiers() = typeInst->get_qualifiers();
 				if ( unifyInexact( newType.get(), other, env, needAssertions, haveAssertions, openVars, widenMode & WidenMode( curClass.allowWidening, true ), indexer, common ) ) {
 					if ( common ) {
@@ -279,4 +283,8 @@
 		TypeEnvironment debugEnv( env );
 #endif
+		if ( type1->get_qualifiers() != type2->get_qualifiers() ) {
+			return false;
+		}
+
 		bool result;
 		TypeInstType *var1 = dynamic_cast< TypeInstType* >( type1 );
@@ -291,7 +299,6 @@
 		bool isopen1 = var1 && ( entry1 != openVars.end() );
 		bool isopen2 = var2 && ( entry2 != openVars.end() );
-		if ( type1->get_qualifiers() != type2->get_qualifiers() ) {
-			return false;
-		} else if ( isopen1 && isopen2 && entry1->second == entry2->second ) {
+
+		if ( isopen1 && isopen2 && entry1->second == entry2->second ) {
 			result = bindVarToVar( var1, var2, entry1->second, env, needAssertions, haveAssertions, openVars, widenMode, indexer );
 		} else if ( isopen1 ) {
