Index: src/GenPoly/Box.cc
===================================================================
--- src/GenPoly/Box.cc	(revision 7cd23d5dd33292e89939b23cf11970e74bf7538a)
+++ src/GenPoly/Box.cc	(revision ed1065cf203b07392f55283f52fd47be3012ffcb)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Rob Schluntz
-// Last Modified On : Tue Nov 24 15:59:33 2015
-// Update Count     : 169
+// Last Modified On : Thu Nov 26 17:01:55 2015
+// Update Count     : 191
 //
 
@@ -145,16 +145,21 @@
 			std::stringstream name;
 
+			// NOTE: this function previously used isPolyObj, which failed to produce
+			// the correct thing in some situations. It's not clear to me why this wasn't working.
+
 			// if the return type or a parameter type involved polymorphic types, then the adapter will need 
 			// to take those polymorphic types as pointers. Therefore, there can be two different functions 
 			// with the same mangled name, so we need to further mangle the names.
-			if ( isPolyRet( function, tyVars ) ) {
-				name << "P";
-			} else {
-				name << "M";
+			for ( std::list< DeclarationWithType *>::iterator retval = function->get_returnVals().begin(); retval != function->get_returnVals().end(); ++retval ) {
+				if ( isPolyVal( (*retval)->get_type(), tyVars ) ) {
+					name << "P";
+				} else {
+					name << "M";
+				}
 			}
 			name << "_";
 			std::list< DeclarationWithType *> &paramList = function->get_parameters();
 			for ( std::list< DeclarationWithType *>::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
-				if ( isPolyObj( (*arg)->get_type(), tyVars ) ) {
+				if ( isPolyVal( (*arg)->get_type(), tyVars ) ) {
 					name << "P";
 				} else {
@@ -197,5 +202,6 @@
 
 		void Pass1::findAssignOps( const std::list< TypeDecl *> &forall ) {
-			assignOps.clear();
+			// what if a nested function uses an assignment operator?
+			// assignOps.clear();
 			for ( std::list< TypeDecl *>::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
 				for ( std::list< DeclarationWithType *>::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
@@ -212,4 +218,5 @@
 				doBeginScope();
 				TyVarMap oldtyVars = scopeTyVars;
+				std::map< std::string, DeclarationWithType *> oldassignOps = assignOps;
 				DeclarationWithType *oldRetval = retval;
 				bool oldUseRetval = useRetval;
@@ -254,4 +261,5 @@
   
 				scopeTyVars = oldtyVars;
+				assignOps = oldassignOps;
 				// std::cerr << "end FunctionDecl: ";
 				// for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
