Index: src/GenPoly/Box.cc
===================================================================
--- src/GenPoly/Box.cc	(revision adc67818491910acdb5cc19b5cb49ba6cefce50f)
+++ src/GenPoly/Box.cc	(revision 63c0dbff99733b7093a5d2218a2b3362a30d0831)
@@ -205,5 +205,5 @@
 			ObjectDecl *makeTemporary( Type *type );
 
-			std::map< std::string, DeclarationWithType *> assignOps;     ///< Currently known type variable assignment operators
+			ScopedMap< std::string, DeclarationWithType *> assignOps;    ///< Currently known type variable assignment operators
 			ResolvExpr::TypeMap< DeclarationWithType > scopedAssignOps;  ///< Currently known assignment operators
 			ScopedMap< std::string, DeclarationWithType* > adapters;     ///< Set of adapter functions in the current scope
@@ -665,5 +665,5 @@
 				doBeginScope();
 				TyVarMap oldtyVars = scopeTyVars;
-				std::map< std::string, DeclarationWithType *> oldassignOps = assignOps;
+				assignOps.beginScope();
 				DeclarationWithType *oldRetval = retval;
 				bool oldUseRetval = useRetval;
@@ -707,10 +707,5 @@
 
 				scopeTyVars = oldtyVars;
-				assignOps = oldassignOps;
-				// std::cerr << "end FunctionDecl: ";
-				// for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
-				// 	std::cerr << i->first << " ";
-				// }
-				// std::cerr << "\n";
+				assignOps.endScope();
 				retval = oldRetval;
 				useRetval = oldUseRetval;
@@ -1386,5 +1381,5 @@
 				if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( retval->get_type() ) ) {
 					// find assignment operator for type variable
-					std::map< std::string, DeclarationWithType *>::const_iterator assignIter = assignOps.find( typeInst->get_name() );
+					ScopedMap< std::string, DeclarationWithType *>::const_iterator assignIter = assignOps.find( typeInst->get_name() );
 					if ( assignIter == assignOps.end() ) {
 						throw SemanticError( "Attempt to return dtype or ftype object in ", returnStmt->get_expr() );
@@ -1420,5 +1415,5 @@
 						DeclarationWithType *assertAssign = 0;
 						if ( TypeInstType *formalTypeInstType = dynamic_cast< TypeInstType* >( formalType ) ) {
-							std::map< std::string, DeclarationWithType *>::const_iterator assertAssignIt = assignOps.find( formalTypeInstType->get_name() );
+							ScopedMap< std::string, DeclarationWithType *>::const_iterator assertAssignIt = assignOps.find( formalTypeInstType->get_name() );
 							if ( assertAssignIt == assignOps.end() ) {
 								throw SemanticError( "No assignment operation found for ", formalTypeInstType );
