Index: src/ResolvExpr/AlternativeFinder.cc
===================================================================
--- src/ResolvExpr/AlternativeFinder.cc	(revision 1db306ace498d673ec16b9dc9be553c62c38774e)
+++ src/ResolvExpr/AlternativeFinder.cc	(revision 2595df1121a07bbced265ffd73c766dcca714ad6)
@@ -131,31 +131,16 @@
 
 	void printAlts( const AltList &list, std::ostream &os, unsigned int indentAmt ) {
-		Indenter indent = { indentAmt };
-
-		std::vector<int> idx;
-		idx.reserve(list.size());
-		for(int i = 0; i < list.size(); i++) { idx.push_back(i); }
-
-		std::sort(idx.begin(), idx.end(), [&list](int lhs_idx, int rhs_idx) -> bool {
-			const auto & lhs = list.at(lhs_idx);
-			const auto & rhs = list.at(rhs_idx);
-			if(lhs.expr->location.startsBefore(rhs.expr->location)) return true;
-			if(rhs.expr->location.startsBefore(lhs.expr->location)) return false;
-
-			if(lhs.env.size() < rhs.env.size()) return true;
-			if(lhs.env.size() > rhs.env.size()) return false;
-
-			if(lhs.openVars.size() < rhs.openVars.size()) return true;
-			if(lhs.openVars.size() > rhs.openVars.size()) return false;
-
-			if(lhs.need.size() < rhs.need.size()) return true;
-			if(lhs.need.size() > rhs.need.size()) return false;
-
-			return false;
-		});
-
-		for ( AltList::const_iterator i = list.begin(); i != list.end(); ++i ) {
-			i->print( os, indent );
-			os << std::endl;
+		std::vector<std::string> sorted;
+		sorted.reserve(list.size());
+		for(const auto & c : list) {
+			std::stringstream ss;
+			print( ss, *c, indentAmt );
+			sorted.push_back(ss.str());
+		}
+
+		std::sort(sorted.begin(), sorted.end());
+
+		for ( const auto & s : sorted ) {
+			os << s << std::endl;
 		}
 	}
Index: src/ResolvExpr/Candidate.cpp
===================================================================
--- src/ResolvExpr/Candidate.cpp	(revision 1db306ace498d673ec16b9dc9be553c62c38774e)
+++ src/ResolvExpr/Candidate.cpp	(revision 2595df1121a07bbced265ffd73c766dcca714ad6)
@@ -41,7 +41,16 @@
 
 void print( std::ostream & os, const CandidateList & cands, Indenter indent ) {
-	for ( const CandidateRef & cand : cands ) {
-		print( os, *cand, indent );
-		os << std::endl;
+	std::vector<std::string> sorted;
+	sorted.reserve(cands.size());
+	for(const auto & c : cands) {
+		std::stringstream ss;
+		print( ss, *c, indent );
+		sorted.push_back(ss.str());
+	}
+
+	std::sort(sorted.begin(), sorted.end());
+
+	for ( const auto & s : sorted ) {
+		os << s << std::endl;
 	}
 }
