Index: src/ResolvExpr/CastCost.cc
===================================================================
--- src/ResolvExpr/CastCost.cc	(revision ca946a45b3577867588c7cb7d196558c7e1b0074)
+++ src/ResolvExpr/CastCost.cc	(revision 0b150eccb21118c3e0226446011f3008a38293e5)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// CastCost.cc -- 
+// CastCost.cc --
 //
 // Author           : Richard C. Bilson
@@ -26,5 +26,5 @@
 	  public:
 		CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
-  
+
 		virtual void visit( BasicType *basicType );
 		virtual void visit( PointerType *pointerType );
@@ -36,5 +36,9 @@
 			NamedTypeDecl *namedType;
 			if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
-				return castCost( src, eqvClass.type, indexer, env );
+				if ( eqvClass.type ) {
+					return castCost( src, eqvClass.type, indexer, env );
+				} else {
+					return Cost::infinity;
+				}
 			} else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
 				TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
Index: src/ResolvExpr/ConversionCost.cc
===================================================================
--- src/ResolvExpr/ConversionCost.cc	(revision ca946a45b3577867588c7cb7d196558c7e1b0074)
+++ src/ResolvExpr/ConversionCost.cc	(revision 0b150eccb21118c3e0226446011f3008a38293e5)
@@ -30,5 +30,9 @@
 ///     std::cout << "type inst " << destAsTypeInst->get_name();
 			if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
-				return conversionCost( src, eqvClass.type, indexer, env );
+				if ( eqvClass.type ) {
+					return conversionCost( src, eqvClass.type, indexer, env );
+				} else {
+					return Cost::infinity;
+				}
 			} else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
 ///       std::cout << " found" << std::endl;
Index: src/ResolvExpr/Resolver.cc
===================================================================
--- src/ResolvExpr/Resolver.cc	(revision ca946a45b3577867588c7cb7d196558c7e1b0074)
+++ src/ResolvExpr/Resolver.cc	(revision 0b150eccb21118c3e0226446011f3008a38293e5)
@@ -124,5 +124,5 @@
 			} // if
 #endif
-			assert( finder.get_alternatives().size() == 1 );
+			assertf( finder.get_alternatives().size() == 1, "findSingleExpression: must have exactly one alternative at the end." );
 			Alternative &choice = finder.get_alternatives().front();
 			Expression *newExpr = choice.expr->clone();
@@ -397,5 +397,5 @@
 			// // 	cerr << type << endl;
 			// // } // for
-			
+
 			// // O(N^2) checks of d-types with f-types
 			// // find the minimum cost
Index: src/ResolvExpr/Unify.cc
===================================================================
--- src/ResolvExpr/Unify.cc	(revision ca946a45b3577867588c7cb7d196558c7e1b0074)
+++ src/ResolvExpr/Unify.cc	(revision 0b150eccb21118c3e0226446011f3008a38293e5)
@@ -344,5 +344,5 @@
 		std::cerr << "unifyInexact type 1 is ";
 		type1->print( std::cerr );
-		std::cerr << "type 2 is ";
+		std::cerr << " type 2 is ";
 		type2->print( std::cerr );
 		std::cerr << std::endl;
@@ -595,5 +595,5 @@
 			TypeExpr *otherParam = dynamic_cast< TypeExpr* >(*jt);
 			assertf(otherParam, "Aggregate parameters should be type expressions");
-			
+
 			Type* paramTy = param->get_type();
 			Type* otherParamTy = otherParam->get_type();
