Index: src/GenPoly/GenPoly.cc
===================================================================
--- src/GenPoly/GenPoly.cc	(revision 5f6c42cb45588a8c01434a4cdd21e083c2b29265)
+++ src/GenPoly/GenPoly.cc	(revision 0f889a775b5d08fc09db103884b46c7de7cd9967)
@@ -68,5 +68,15 @@
 
 	namespace {
-		/// Checks a parameter list for polymorphic parameters
+		/// Checks a parameter list for polymorphic parameters; will substitute according to env if present
+		bool hasPolyParams( std::list< Expression* >& params, const TypeSubstitution *env ) {
+			for ( std::list< Expression* >::iterator param = params.begin(); param != params.end(); ++param ) {
+				TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
+				assert(paramType && "Aggregate parameters should be type expressions");
+				if ( isPolyType( paramType->get_type(), env ) ) return true;
+			}
+			return false;
+		}
+
+		/// Checks a parameter list for polymorphic parameters from tyVars; will substitute according to env if present
 		bool hasPolyParams( std::list< Expression* >& params, const TyVarMap &tyVars, const TypeSubstitution *env ) {
 			for ( std::list< Expression* >::iterator param = params.begin(); param != params.end(); ++param ) {
@@ -78,4 +88,20 @@
 		}
 	}
+
+	Type *isPolyType( Type *type, const TypeSubstitution *env ) {
+		if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) {
+			if ( env ) {
+				if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
+					return isPolyType( newType, env );
+				} // if
+			} // if
+			return type;
+		} else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
+			if ( hasPolyParams( structType->get_parameters(), env ) ) return type;
+		} else if ( UnionInstType *unionType = dynamic_cast< UnionInstType* >( type ) ) {
+			if ( hasPolyParams( unionType->get_parameters(), env ) ) return type;
+		}
+		return 0;
+	}
 	
 	Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {
@@ -84,9 +110,9 @@
 				if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
 					return isPolyType( newType, tyVars, env );
+				} // if
 			} // if
-		} // if
 			if ( tyVars.find( typeInst->get_name() ) != tyVars.end() ) {
 				return type;
-	}
+			}
 		} else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
 			if ( hasPolyParams( structType->get_parameters(), tyVars, env ) ) return type;
@@ -97,4 +123,17 @@
 	}
 
+	Type *isPolyPtr( Type *type, const TypeSubstitution *env ) {
+		if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) {
+			return isPolyType( ptr->get_base(), env );
+		} else if ( env ) {
+			if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( type ) ) {
+				if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
+					return isPolyPtr( newType, env );
+				} // if
+			} // if
+		} // if
+		return 0;
+	}
+	
 	Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {
 		if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) {
Index: src/GenPoly/GenPoly.h
===================================================================
--- src/GenPoly/GenPoly.h	(revision 5f6c42cb45588a8c01434a4cdd21e083c2b29265)
+++ src/GenPoly/GenPoly.h	(revision 0f889a775b5d08fc09db103884b46c7de7cd9967)
@@ -37,7 +37,13 @@
 
 	/// returns polymorphic type if is polymorphic type, NULL otherwise; will look up substitution in env if provided
+	Type *isPolyType( Type *type, const TypeSubstitution *env = 0 );
+	
+	/// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
 	Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
 
 	/// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided
+	Type *isPolyPtr( Type *type, const TypeSubstitution *env = 0 );
+	
+	/// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
 	Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
 
