Index: translator/ResolvExpr/CastCost.cc
===================================================================
--- translator/ResolvExpr/CastCost.cc	(revision bdd516a5257cb93cc0c5b4a4c343cc112252022a)
+++ translator/ResolvExpr/CastCost.cc	(revision c11e31cbaeeeb0709ef952223453f301da13d515)
@@ -1,9 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * $Id: CastCost.cc,v 1.11 2005/08/29 20:14:15 rcbilson Exp $
- *
- */
-
 #include "typeops.h"
 #include "Cost.h"
@@ -15,91 +8,74 @@
 
 namespace ResolvExpr {
+    class CastCost : public ConversionCost {
+      public:
+	CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
+  
+	virtual void visit( BasicType *basicType );
+	virtual void visit( PointerType *pointerType );
+    };
 
-class CastCost : public ConversionCost
-{
-public:
-  CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
-  
-  virtual void visit(BasicType *basicType);
-  virtual void visit(PointerType *pointerType);
-};
+    Cost castCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
+	if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
+	    EqvClass eqvClass;
+	    NamedTypeDecl *namedType;
+	    if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
+		return castCost( src, eqvClass.type, indexer, env );
+	    } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
+		TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
+		// all typedefs should be gone by this point
+		assert( type );
+		if ( type->get_base() ) {
+		    return castCost( src, type->get_base(), indexer, env ) + Cost( 0, 0, 1 );
+		} // if
+	    } // if
+	} // if
+	if ( typesCompatibleIgnoreQualifiers( src, dest, indexer, env ) ) {
+	    return Cost( 0, 0, 0 );
+	} else if ( dynamic_cast< VoidType* >( dest ) ) {
+	    return Cost( 0, 0, 1 );
+	} else {
+	    CastCost converter( dest, indexer, env );
+	    src->accept( converter );
+	    if ( converter.get_cost() == Cost::infinity ) {
+		return Cost::infinity;
+	    } else {
+		return converter.get_cost() + Cost( 0, 0, 0 );
+	    } // if
+	} // if
+    }
 
-Cost
-castCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env )
-{
-//  std::cout << "casting" << std::endl;
-//  src->print( std::cout, 8 );
-//  std::cout << std::endl << "to" << std::endl;
-//  dest->print( std::cout, 8 );
-  if( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
-    EqvClass eqvClass;
-    NamedTypeDecl *namedType;
-    if( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
-      return castCost( src, eqvClass.type, indexer, env );
-    } else if( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
-      TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
-      // all typedefs should be gone by this point
-      assert( type );
-      if( type->get_base() ) {
-        return castCost( src, type->get_base(), indexer, env ) + Cost( 0, 0, 1 );
-      }
+    CastCost::CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env )
+	: ConversionCost( dest, indexer, env ) {
     }
-  }
-  if( typesCompatibleIgnoreQualifiers( src, dest, indexer, env ) ) {
-//    std::cout << "types are compatible" << std::endl;
-    return Cost( 0, 0, 0 );
-  } else if( dynamic_cast< VoidType* >( dest ) ) {
-//    std::cout << "destination is void" << std::endl;
-    return Cost( 0, 0, 1 );
-  } else {
-    CastCost converter( dest, indexer, env );
-    src->accept( converter );
-//    std::cout << "cost is " << converter.get_cost() << std::endl;
-    if( converter.get_cost() == Cost::infinity ) {
-      return Cost::infinity;
-    } else {
-      return converter.get_cost() + Cost( 0, 0, 0 );
+
+    void CastCost::visit( BasicType *basicType ) {
+	if ( dynamic_cast< PointerType* >( dest ) ) {
+	    cost = Cost( 1, 0, 0 );
+	} else {
+	    ConversionCost::visit( basicType );
+	} // if
     }
-  }
-}
 
-CastCost::CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env )
-  : ConversionCost( dest, indexer, env )
-{
-}
-
-void 
-CastCost::visit(BasicType *basicType)
-{
-  if( dynamic_cast< PointerType* >( dest ) ) {
-    cost = Cost( 1, 0, 0 );
-  } else {
-    ConversionCost::visit( basicType );
-  }
-}
-
-void 
-CastCost::visit(PointerType *pointerType)
-{
-  if( PointerType *destAsPtr = dynamic_cast< PointerType* >( dest ) ) {
-    if( pointerType->get_qualifiers() <= destAsPtr->get_qualifiers() && typesCompatibleIgnoreQualifiers( pointerType->get_base(), destAsPtr->get_base(), indexer, env ) ) {
-      cost = Cost( 0, 0, 1 );
-    } else if( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {
-      if( destAsBasic->isInteger() ) {
-        cost = Cost( 1, 0, 0 );
-      }
-    } else {
-      TypeEnvironment newEnv( env );
-      newEnv.add( pointerType->get_forall() );
-      newEnv.add( pointerType->get_base()->get_forall() );
-      int assignResult = ptrsCastable( pointerType->get_base(), destAsPtr->get_base(), newEnv, indexer );
-      if( assignResult > 0 ) {
-        cost = Cost( 0, 0, 1 );
-      } else if( assignResult < 0 ) {
-        cost = Cost( 1, 0, 0 );
-      }
+    void CastCost::visit( PointerType *pointerType ) {
+	if ( PointerType *destAsPtr = dynamic_cast< PointerType* >( dest ) ) {
+	    if ( pointerType->get_qualifiers() <= destAsPtr->get_qualifiers() && typesCompatibleIgnoreQualifiers( pointerType->get_base(), destAsPtr->get_base(), indexer, env ) ) {
+		cost = Cost( 0, 0, 1 );
+	    } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {
+		if ( destAsBasic->isInteger() ) {
+		    cost = Cost( 1, 0, 0 );
+		}
+	    } else {
+		TypeEnvironment newEnv( env );
+		newEnv.add( pointerType->get_forall() );
+		newEnv.add( pointerType->get_base()->get_forall() );
+		int assignResult = ptrsCastable( pointerType->get_base(), destAsPtr->get_base(), newEnv, indexer );
+		if ( assignResult > 0 ) {
+		    cost = Cost( 0, 0, 1 );
+		} else if ( assignResult < 0 ) {
+		    cost = Cost( 1, 0, 0 );
+		} // if
+	    } // if
+	} // if
     }
-  }
-}
-
 } // namespace ResolvExpr
Index: translator/ResolvExpr/PtrsAssignable.cc
===================================================================
--- translator/ResolvExpr/PtrsAssignable.cc	(revision bdd516a5257cb93cc0c5b4a4c343cc112252022a)
+++ translator/ResolvExpr/PtrsAssignable.cc	(revision c11e31cbaeeeb0709ef952223453f301da13d515)
@@ -1,9 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * $Id: PtrsAssignable.cc,v 1.3 2005/08/29 20:14:16 rcbilson Exp $
- *
- */
-
 #include "typeops.h"
 #include "SynTree/Type.h"
@@ -13,128 +6,99 @@
 
 namespace ResolvExpr {
+    class PtrsAssignable : public Visitor {
+      public:
+	PtrsAssignable( Type *dest, const TypeEnvironment &env );
+  
+	int get_result() const { return result; }
 
-class PtrsAssignable : public Visitor
-{
-public:
-  PtrsAssignable( Type *dest, const TypeEnvironment &env );
-  
-  int get_result() const { return result; }
+	virtual void visit(VoidType *voidType);
+	virtual void visit(BasicType *basicType);
+	virtual void visit(PointerType *pointerType);
+	virtual void visit(ArrayType *arrayType);
+	virtual void visit(FunctionType *functionType);
+	virtual void visit(StructInstType *inst);
+	virtual void visit(UnionInstType *inst);
+	virtual void visit(EnumInstType *inst);
+	virtual void visit(ContextInstType *inst);
+	virtual void visit(TypeInstType *inst);
+	virtual void visit(TupleType *tupleType);
+      private:
+	Type *dest;
+	int result;
+	const TypeEnvironment &env;
+    };
 
-  virtual void visit(VoidType *voidType);
-  virtual void visit(BasicType *basicType);
-  virtual void visit(PointerType *pointerType);
-  virtual void visit(ArrayType *arrayType);
-  virtual void visit(FunctionType *functionType);
-  virtual void visit(StructInstType *inst);
-  virtual void visit(UnionInstType *inst);
-  virtual void visit(EnumInstType *inst);
-  virtual void visit(ContextInstType *inst);
-  virtual void visit(TypeInstType *inst);
-  virtual void visit(TupleType *tupleType);
+    int ptrsAssignable( Type *src, Type *dest, const TypeEnvironment &env ) {
+	if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
+	    EqvClass eqvClass;
+	    if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
+		return ptrsAssignable( src, eqvClass.type, env );
+	    }
+	}
+	if ( dynamic_cast< VoidType* >( dest ) ) {
+	    return 1;
+	} else {
+	    PtrsAssignable ptrs( dest, env );
+	    src->accept( ptrs );
+	    return ptrs.get_result();
+	}
+    }
 
-private:
-  Type *dest;
-  int result;
-  const TypeEnvironment &env;
-};
+    PtrsAssignable::PtrsAssignable( Type *dest, const TypeEnvironment &env ) : dest( dest ), result( 0 ), env( env ) {
+    }
 
-int
-ptrsAssignable( Type *src, Type *dest, const TypeEnvironment &env )
-{
-  if( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
-    EqvClass eqvClass;
-    if( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
-      return ptrsAssignable( src, eqvClass.type, env );
+    void PtrsAssignable::visit(VoidType *voidType) {
+	if ( dynamic_cast< FunctionType* >( dest ) ) {
+	    result = 0;
+	} else {
+	    result = -1;
+	}
     }
-  }
-  if( dynamic_cast< VoidType* >( dest ) ) {
-    return 1;
-  } else {
-    PtrsAssignable ptrs( dest, env );
-    src->accept( ptrs );
-    return ptrs.get_result();
-  }
-}
 
-PtrsAssignable::PtrsAssignable( Type *dest, const TypeEnvironment &env )
-  : dest( dest ), result( 0 ), env( env )
-{
-}
+    void PtrsAssignable::visit( BasicType *basicType ) {
+    }
 
-void 
-PtrsAssignable::visit(VoidType *voidType)
-{
-  if( dynamic_cast< FunctionType* >( dest ) ) {
-    result = 0;
-  } else {
-    result = -1;
-  }
-}
+    void PtrsAssignable::visit( PointerType *pointerType ) {
+    }
 
-void 
-PtrsAssignable::visit(BasicType *basicType)
-{
-}
+    void PtrsAssignable::visit( ArrayType *arrayType ) {
+    }
 
-void 
-PtrsAssignable::visit(PointerType *pointerType)
-{
-}
+    void PtrsAssignable::visit( FunctionType *functionType ) {
+	result = -1;
+    }
 
-void 
-PtrsAssignable::visit(ArrayType *arrayType)
-{
-}
+    void PtrsAssignable::visit( StructInstType *inst ) {
+	// I don't think we should be doing anything here, but I'm willing to admit that I might be wrong
+    }
 
-void 
-PtrsAssignable::visit(FunctionType *functionType)
-{
-  result = -1;
-}
+    void PtrsAssignable::visit( UnionInstType *inst ) {
+	// I don't think we should be doing anything here, but I'm willing to admit that I might be wrong
+    }
 
-void 
-PtrsAssignable::visit(StructInstType *inst)
-{
-  // I don't think we should be doing anything here, but I'm willing to admit that I might be wrong
-}
+    void PtrsAssignable::visit( EnumInstType *inst ) {
+	if ( dynamic_cast< EnumInstType* >( inst ) ) {
+	    result = 1;
+	} else if ( BasicType *bt = dynamic_cast< BasicType* >( inst ) ) {
+	    result = bt->get_kind() == BasicType::SignedInt;
+	}
+    }
 
-void 
-PtrsAssignable::visit(UnionInstType *inst)
-{
-  // I don't think we should be doing anything here, but I'm willing to admit that I might be wrong
-}
+    void PtrsAssignable::visit( ContextInstType *inst ) {
+	// I definitely don't think we should be doing anything here
+    }
 
-void 
-PtrsAssignable::visit(EnumInstType *inst)
-{
-  if( dynamic_cast< EnumInstType* >( inst ) ) {
-    result = 1;
-  } else if( BasicType *bt = dynamic_cast< BasicType* >( inst ) ) {
-    result = bt->get_kind() == BasicType::SignedInt;
-  }
-}
+    void PtrsAssignable::visit( TypeInstType *inst ) {
+	EqvClass eqvClass;
+	if ( env.lookup( inst->get_name(), eqvClass ) ) {
+	    result = ptrsAssignable( eqvClass.type, dest, env );
+	} else {
+	    result = 0;
+	}
+    }
 
-void 
-PtrsAssignable::visit(ContextInstType *inst)
-{
-  // I definitely don't think we should be doing anything here
-}
-
-void 
-PtrsAssignable::visit(TypeInstType *inst)
-{
-  EqvClass eqvClass;
-  if( env.lookup( inst->get_name(), eqvClass ) ) {
-    result = ptrsAssignable( eqvClass.type, dest, env );
-  } else {
-    result = 0;
-  }
-}
-
-void 
-PtrsAssignable::visit(TupleType *tupleType)
-{
+    void PtrsAssignable::visit( TupleType *tupleType ) {
 ///  // This code doesn't belong here, but it might be useful somewhere else
-///   if( TupleType *destAsTuple = dynamic_cast< TupleType* >( dest ) ) {
+///   if ( TupleType *destAsTuple = dynamic_cast< TupleType* >( dest ) ) {
 ///     int ret = 0;
 ///     std::list< Type* >::const_iterator srcIt = tupleType->get_types().begin();
@@ -142,5 +106,5 @@
 ///     while( srcIt != tupleType->get_types().end() && destIt != destAsTuple->get_types().end() ) {
 ///       int assignResult = ptrsAssignable( *srcIt++, *destIt++ );
-///       if( assignResult == 0 ) {
+///       if ( assignResult == 0 ) {
 ///         result = assignResult;
 ///         return;
@@ -151,5 +115,5 @@
 ///       }
 ///     }
-///     if( srcIt == tupleType->get_types().end() && destIt == destAsTuple->get_types().end() ) {
+///     if ( srcIt == tupleType->get_types().end() && destIt == destAsTuple->get_types().end() ) {
 ///       result = ret;
 ///     } else {
@@ -157,5 +121,4 @@
 ///     }
 ///   }
-}
-
+    }
 } // namespace ResolvExpr
Index: translator/ResolvExpr/Resolver.cc
===================================================================
--- translator/ResolvExpr/Resolver.cc	(revision bdd516a5257cb93cc0c5b4a4c343cc112252022a)
+++ translator/ResolvExpr/Resolver.cc	(revision c11e31cbaeeeb0709ef952223453f301da13d515)
@@ -98,5 +98,5 @@
 		return bt->isInteger();
 	    } else {
-		return true;
+		return false;
 	    } // if
 	}
@@ -121,5 +121,5 @@
 		if ( i->expr->get_results().size() == 1 && isIntegralType( i->expr->get_results().front() ) ) {
 		    if ( newExpr ) {
-			throw SemanticError( "Too many interpretations for switch control expression", untyped );
+			throw SemanticError( "Too many interpretations for case control expression", untyped );
 		    } else {
 			newExpr = i->expr->clone();
@@ -128,6 +128,6 @@
 		} // if
 	    } // for
-	    if ( !newExpr ) {
-		throw SemanticError( "Too many interpretations for switch control expression", untyped );
+	    if ( ! newExpr ) {
+		throw SemanticError( "No interpretations for case control expression", untyped );
 	    } // if
 	    finishExpr( newExpr, *newEnv );
