Index: src/ResolvExpr/Cost.h
===================================================================
--- src/ResolvExpr/Cost.h	(revision d97c3a4b9cfd1040061ab2ac4708294336c5404b)
+++ src/ResolvExpr/Cost.h	(revision 53bb8f1f8cae8a384c5024ab0caed57d27778a0d)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Sun May 17 09:39:50 2015
-// Last Modified By : Aaron B. Moss
-// Last Modified On : Fri Oct 05 14:32:00 2018
-// Update Count     : 7
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Feb  7 20:54:29 2019
+// Update Count     : 8
 //
 
@@ -21,11 +21,11 @@
 	class Cost {
 	  private:
-		Cost( int unsafeCost, int polyCost, int safeCost, int varCost, int specCost,
-			int referenceCost );
-
+		Cost( int unsafeCost, int polyCost, int safeCost, int signCost,
+			int varCost, int specCost, int referenceCost );
 	  public:
 		Cost & incUnsafe( int inc = 1 );
 		Cost & incPoly( int inc = 1 );
 		Cost & incSafe( int inc = 1 );
+		Cost & incSign( int inc = 1 );
 		Cost & incVar( int inc = 1 );
 		Cost & decSpec( int inc = 1 );
@@ -35,4 +35,5 @@
 		int get_polyCost() const { return polyCost; }
 		int get_safeCost() const { return safeCost; }
+		int get_signCost() const { return signCost; }
 		int get_varCost() const { return varCost; }
 		int get_specCost() const { return specCost; }
@@ -40,5 +41,4 @@
 
 		Cost operator+( const Cost &other ) const;
-		Cost operator-( const Cost &other ) const;
 		Cost &operator+=( const Cost &other );
 		bool operator<( const Cost &other ) const;
@@ -55,4 +55,5 @@
 		static const Cost poly;
 		static const Cost safe;
+		static const Cost sign;
 		static const Cost var;
 		static const Cost spec;
@@ -63,4 +64,5 @@
 		int polyCost;       ///< Count of parameters and return values bound to some poly type
 		int safeCost;       ///< Safe (widening) conversions
+		int signCost;       ///< Count of safe sign conversions
 		int varCost;        ///< Count of polymorphic type variables
 		int specCost;       ///< Polymorphic type specializations (type assertions), negative cost
@@ -68,8 +70,8 @@
 	};
 
-	inline Cost::Cost( int unsafeCost, int polyCost, int safeCost, int varCost, int specCost, 
-			int referenceCost ) 
-		: unsafeCost( unsafeCost ), polyCost( polyCost ), safeCost( safeCost ), varCost( varCost ), 
-		  specCost( specCost ), referenceCost( referenceCost ) {}
+	inline Cost::Cost( int unsafeCost, int polyCost, int safeCost, int signCost,
+			int varCost, int specCost, int referenceCost )
+		: unsafeCost( unsafeCost ), polyCost( polyCost ), safeCost( safeCost ), signCost( signCost ),
+		  varCost( varCost ), specCost( specCost ), referenceCost( referenceCost ) {}
 
 	inline Cost & Cost::incUnsafe( int inc ) {
@@ -88,4 +90,10 @@
 		if ( *this == infinity ) return *this;
 		safeCost += inc;
+		return *this;
+	}
+
+	inline Cost & Cost::incSign( int inc ) {
+		if ( *this == infinity ) return *this;
+		signCost += inc;
 		return *this;
 	}
@@ -111,16 +119,8 @@
 	inline Cost Cost::operator+( const Cost &other ) const {
 		if ( *this == infinity || other == infinity ) return infinity;
-		return Cost{ 
-			unsafeCost + other.unsafeCost, polyCost + other.polyCost, safeCost + other.safeCost, 
-			varCost + other.varCost, specCost + other.specCost, 
+		return Cost{
+			unsafeCost + other.unsafeCost, polyCost + other.polyCost, safeCost + other.safeCost,
+			signCost + other.signCost, varCost + other.varCost, specCost + other.specCost,
 			referenceCost + other.referenceCost };
-	}
-
-	inline Cost Cost::operator-( const Cost &other ) const {
-		if ( *this == infinity || other == infinity ) return infinity;
-		return Cost{ 
-			unsafeCost - other.unsafeCost, polyCost - other.polyCost, safeCost - other.safeCost, 
-			varCost - other.varCost, specCost - other.specCost, 
-			referenceCost - other.referenceCost };
 	}
 
@@ -134,4 +134,5 @@
 		polyCost += other.polyCost;
 		safeCost += other.safeCost;
+		signCost += other.signCost;
 		varCost += other.varCost;
 		specCost += other.specCost;
@@ -156,4 +157,8 @@
 		} else if ( safeCost < other.safeCost ) {
 			return true;
+		} else if ( signCost > other.signCost ) {
+			return false;
+		} else if ( signCost < other.signCost ) {
+			return true;
 		} else if ( varCost > other.varCost ) {
 			return false;
@@ -180,4 +185,5 @@
 		c = polyCost - other.polyCost; if ( c ) return c;
 		c = safeCost - other.safeCost; if ( c ) return c;
+		c = signCost - other.signCost; if ( c ) return c;
 		c = varCost - other.varCost; if ( c ) return c;
 		c = specCost - other.specCost; if ( c ) return c;
@@ -189,4 +195,5 @@
 			&& polyCost == other.polyCost
 			&& safeCost == other.safeCost
+			&& signCost == other.signCost
 			&& varCost == other.varCost
 			&& specCost == other.specCost
@@ -199,6 +206,7 @@
 
 	inline std::ostream &operator<<( std::ostream &os, const Cost &cost ) {
-		return os << "( " << cost.unsafeCost << ", " << cost.polyCost << ", " 
-		          << cost.safeCost << ", " << cost.varCost << ", " << cost.specCost << ", "
+		return os << "( " << cost.unsafeCost << ", " << cost.polyCost << ", "
+		          << cost.safeCost << ", " << cost.signCost << ", "
+				  << cost.varCost << ", " << cost.specCost << ", "
 		          << cost.referenceCost << " )";
 	}
