Index: src/ResolvExpr/CandidateFinder.cpp
===================================================================
--- src/ResolvExpr/CandidateFinder.cpp	(revision 7f62b70877e4fa96cf64abb308b9ef2b9528dde9)
+++ src/ResolvExpr/CandidateFinder.cpp	(revision 3c79ea90a8fd40d78d65b7465383c83051a807e0)
@@ -10,6 +10,6 @@
 // Created On       : Wed Jun 5 14:30:00 2019
 // Last Modified By : Andrew Beach
-// Last Modified On : Tue Oct  1 14:55:00 2019
-// Update Count     : 2
+// Last Modified On : Wed Mar 16 11:58:00 2022
+// Update Count     : 3
 //
 
@@ -595,4 +595,5 @@
 	/// Actually visits expressions to find their candidate interpretations
 	class Finder final : public ast::WithShortCircuiting {
+		const ResolveContext & context;
 		const ast::SymbolTable & symtab;
 	public:
@@ -618,6 +619,6 @@
 
 		Finder( CandidateFinder & f )
-		: symtab( f.localSyms ), selfFinder( f ), candidates( f.candidates ), tenv( f.env ),
-		  targetType( f.targetType ) {}
+		: context( f.context ), symtab( context.symtab ), selfFinder( f ),
+		  candidates( f.candidates ), tenv( f.env ), targetType( f.targetType ) {}
 
 		void previsit( const ast::Node * ) { visit_children = false; }
@@ -872,5 +873,5 @@
 			Tuples::handleTupleAssignment( selfFinder, untypedExpr, argCandidates );
 
-			CandidateFinder funcFinder{ symtab, tenv };
+			CandidateFinder funcFinder( context, tenv );
 			if (auto nameExpr = untypedExpr->func.as<ast::NameExpr>()) {
 				auto kind = ast::SymbolTable::getSpecialFunctionKind(nameExpr->name);
@@ -918,5 +919,5 @@
 			// find function operators
 			ast::ptr< ast::Expr > opExpr = new ast::NameExpr{ untypedExpr->location, "?()" };
-			CandidateFinder opFinder{ symtab, tenv };
+			CandidateFinder opFinder( context, tenv );
 			// okay if there aren't any function operations
 			opFinder.find( opExpr, ResolvMode::withoutFailFast() );
@@ -1059,5 +1060,5 @@
 
 		void postvisit( const ast::AddressExpr * addressExpr ) {
-			CandidateFinder finder{ symtab, tenv };
+			CandidateFinder finder( context, tenv );
 			finder.find( addressExpr->arg );
 
@@ -1079,9 +1080,9 @@
 			ast::ptr< ast::Type > toType = castExpr->result;
 			assert( toType );
-			toType = resolveTypeof( toType, symtab );
+			toType = resolveTypeof( toType, context );
 			// toType = SymTab::validateType( castExpr->location, toType, symtab );
 			toType = adjustExprType( toType, tenv, symtab );
 
-			CandidateFinder finder{ symtab, tenv, toType };
+			CandidateFinder finder( context, tenv, toType );
 			finder.find( castExpr->arg, ResolvMode::withAdjustment() );
 
@@ -1136,5 +1137,5 @@
 		void postvisit( const ast::VirtualCastExpr * castExpr ) {
 			assertf( castExpr->result, "Implicit virtual cast targets not yet supported." );
-			CandidateFinder finder{ symtab, tenv };
+			CandidateFinder finder( context, tenv );
 			// don't prune here, all alternatives guaranteed to have same type
 			finder.find( castExpr->arg, ResolvMode::withoutPrune() );
@@ -1153,5 +1154,5 @@
 			auto target = inst->base.get();
 
-			CandidateFinder finder{ symtab, tenv };
+			CandidateFinder finder( context, tenv );
 
 			auto pick_alternatives = [target, this](CandidateList & found, bool expect_ref) {
@@ -1202,5 +1203,5 @@
 
 		void postvisit( const ast::UntypedMemberExpr * memberExpr ) {
-			CandidateFinder aggFinder{ symtab, tenv };
+			CandidateFinder aggFinder( context, tenv );
 			aggFinder.find( memberExpr->aggregate, ResolvMode::withAdjustment() );
 			for ( CandidateRef & agg : aggFinder.candidates ) {
@@ -1287,9 +1288,9 @@
 				addCandidate(
 					new ast::SizeofExpr{
-						sizeofExpr->location, resolveTypeof( sizeofExpr->type, symtab ) },
+						sizeofExpr->location, resolveTypeof( sizeofExpr->type, context ) },
 					tenv );
 			} else {
 				// find all candidates for the argument to sizeof
-				CandidateFinder finder{ symtab, tenv };
+				CandidateFinder finder( context, tenv );
 				finder.find( sizeofExpr->expr );
 				// find the lowest-cost candidate, otherwise ambiguous
@@ -1311,9 +1312,9 @@
 				addCandidate(
 					new ast::AlignofExpr{
-						alignofExpr->location, resolveTypeof( alignofExpr->type, symtab ) },
+						alignofExpr->location, resolveTypeof( alignofExpr->type, context ) },
 					tenv );
 			} else {
 				// find all candidates for the argument to alignof
-				CandidateFinder finder{ symtab, tenv };
+				CandidateFinder finder( context, tenv );
 				finder.find( alignofExpr->expr );
 				// find the lowest-cost candidate, otherwise ambiguous
@@ -1354,9 +1355,9 @@
 
 		void postvisit( const ast::LogicalExpr * logicalExpr ) {
-			CandidateFinder finder1{ symtab, tenv };
+			CandidateFinder finder1( context, tenv );
 			finder1.find( logicalExpr->arg1, ResolvMode::withAdjustment() );
 			if ( finder1.candidates.empty() ) return;
 
-			CandidateFinder finder2{ symtab, tenv };
+			CandidateFinder finder2( context, tenv );
 			finder2.find( logicalExpr->arg2, ResolvMode::withAdjustment() );
 			if ( finder2.candidates.empty() ) return;
@@ -1384,15 +1385,15 @@
 		void postvisit( const ast::ConditionalExpr * conditionalExpr ) {
 			// candidates for condition
-			CandidateFinder finder1{ symtab, tenv };
+			CandidateFinder finder1( context, tenv );
 			finder1.find( conditionalExpr->arg1, ResolvMode::withAdjustment() );
 			if ( finder1.candidates.empty() ) return;
 
 			// candidates for true result
-			CandidateFinder finder2{ symtab, tenv };
+			CandidateFinder finder2( context, tenv );
 			finder2.find( conditionalExpr->arg2, ResolvMode::withAdjustment() );
 			if ( finder2.candidates.empty() ) return;
 
 			// candidates for false result
-			CandidateFinder finder3{ symtab, tenv };
+			CandidateFinder finder3( context, tenv );
 			finder3.find( conditionalExpr->arg3, ResolvMode::withAdjustment() );
 			if ( finder3.candidates.empty() ) return;
@@ -1445,7 +1446,7 @@
 		void postvisit( const ast::CommaExpr * commaExpr ) {
 			ast::TypeEnvironment env{ tenv };
-			ast::ptr< ast::Expr > arg1 = resolveInVoidContext( commaExpr->arg1, symtab, env );
-
-			CandidateFinder finder2{ symtab, env };
+			ast::ptr< ast::Expr > arg1 = resolveInVoidContext( commaExpr->arg1, context, env );
+
+			CandidateFinder finder2( context, env );
 			finder2.find( commaExpr->arg2, ResolvMode::withAdjustment() );
 
@@ -1460,5 +1461,5 @@
 
 		void postvisit( const ast::ConstructorExpr * ctorExpr ) {
-			CandidateFinder finder{ symtab, tenv };
+			CandidateFinder finder( context, tenv );
 			finder.find( ctorExpr->callExpr, ResolvMode::withoutPrune() );
 			for ( CandidateRef & r : finder.candidates ) {
@@ -1469,9 +1470,9 @@
 		void postvisit( const ast::RangeExpr * rangeExpr ) {
 			// resolve low and high, accept candidates where low and high types unify
-			CandidateFinder finder1{ symtab, tenv };
+			CandidateFinder finder1( context, tenv );
 			finder1.find( rangeExpr->low, ResolvMode::withAdjustment() );
 			if ( finder1.candidates.empty() ) return;
 
-			CandidateFinder finder2{ symtab, tenv };
+			CandidateFinder finder2( context, tenv );
 			finder2.find( rangeExpr->high, ResolvMode::withAdjustment() );
 			if ( finder2.candidates.empty() ) return;
@@ -1549,5 +1550,5 @@
 
 		void postvisit( const ast::UniqueExpr * unqExpr ) {
-			CandidateFinder finder{ symtab, tenv };
+			CandidateFinder finder( context, tenv );
 			finder.find( unqExpr->expr, ResolvMode::withAdjustment() );
 			for ( CandidateRef & r : finder.candidates ) {
@@ -1558,5 +1559,5 @@
 
 		void postvisit( const ast::StmtExpr * stmtExpr ) {
-			addCandidate( resolveStmtExpr( stmtExpr, symtab ), tenv );
+			addCandidate( resolveStmtExpr( stmtExpr, context ), tenv );
 		}
 
@@ -1570,5 +1571,5 @@
 			for ( const ast::InitAlternative & initAlt : initExpr->initAlts ) {
 				// calculate target type
-				const ast::Type * toType = resolveTypeof( initAlt.type, symtab );
+				const ast::Type * toType = resolveTypeof( initAlt.type, context );
 				// toType = SymTab::validateType( initExpr->location, toType, symtab );
 				toType = adjustExprType( toType, tenv, symtab );
@@ -1576,5 +1577,5 @@
 				// types are not bound to the initialization type, since return type variables are
 				// only open for the duration of resolving the UntypedExpr.
-				CandidateFinder finder{ symtab, tenv, toType };
+				CandidateFinder finder( context, tenv, toType );
 				finder.find( initExpr->expr, ResolvMode::withAdjustment() );
 				for ( CandidateRef & cand : finder.candidates ) {
@@ -1693,5 +1694,5 @@
 		}
 		else {
-			satisfyAssertions(candidate, localSyms, satisfied, errors);
+			satisfyAssertions(candidate, context.symtab, satisfied, errors);
 			needRecomputeKey = true;
 		}
@@ -1855,5 +1856,5 @@
 			r->expr = ast::mutate_field(
 				r->expr.get(), &ast::Expr::result,
-				adjustExprType( r->expr->result, r->env, localSyms ) );
+				adjustExprType( r->expr->result, r->env, context.symtab ) );
 		}
 	}
@@ -1873,5 +1874,5 @@
 
 	for ( const auto & x : xs ) {
-		out.emplace_back( localSyms, env );
+		out.emplace_back( context, env );
 		out.back().find( x, ResolvMode::withAdjustment() );
 
