Index: src/GenPoly/Specialize.cc
===================================================================
--- src/GenPoly/Specialize.cc	(revision a365e0dc71361561076d5a26ee3b8253c0604c74)
+++ src/GenPoly/Specialize.cc	(revision bb666f649c7489fc5da7103d9f3f6dd470486575)
@@ -45,10 +45,9 @@
 	struct Specialize final : public WithTypeSubstitution, public WithStmtsToAdd, public WithVisitorRef<Specialize> {
 		Expression * postmutate( ApplicationExpr *applicationExpr );
-		Expression * postmutate( AddressExpr *castExpr );
 		Expression * postmutate( CastExpr *castExpr );
 
 		void handleExplicitParams( ApplicationExpr *appExpr );
 		Expression * createThunkFunction( FunctionType *funType, Expression *actual, InferredParams *inferParams );
-		Expression * doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams = nullptr );
+		Expression * doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams );
 
 		std::string paramPrefix = "_p";
@@ -131,7 +130,7 @@
 			if ( functionParameterSize( fftype ) != functionParameterSize( aftype ) ) return false;
 			// tuple-parameter sizes are the same, but actual parameter sizes differ - must tuple specialize
-			if ( fftype->get_parameters().size() != aftype->get_parameters().size() ) return true;
+			if ( fftype->parameters.size() != aftype->parameters.size() ) return true;
 			// total parameter size can be the same, while individual parameters can have different structure
-			for ( auto params : group_iterate( fftype->get_parameters(), aftype->get_parameters() ) ) {
+			for ( auto params : group_iterate( fftype->parameters, aftype->parameters ) ) {
 				DeclarationWithType * formal = std::get<0>(params);
 				DeclarationWithType * actual = std::get<1>(params);
@@ -150,9 +149,7 @@
 		if ( needsSpecialization( formalType, actual->get_result(), env ) ) {
 			if ( FunctionType *funType = getFunctionType( formalType ) ) {
-				ApplicationExpr *appExpr;
-				VariableExpr *varExpr;
-				if ( ( appExpr = dynamic_cast<ApplicationExpr*>( actual ) ) ) {
+				if ( ApplicationExpr * appExpr = dynamic_cast<ApplicationExpr*>( actual ) ) {
 					return createThunkFunction( funType, appExpr->get_function(), inferParams );
-				} else if ( ( varExpr = dynamic_cast<VariableExpr*>( actual ) ) ) {
+				} else if ( VariableExpr * varExpr = dynamic_cast<VariableExpr*>( actual ) ) {
 					return createThunkFunction( funType, varExpr, inferParams );
 				} else {
@@ -323,10 +320,4 @@
 	}
 
-	Expression * Specialize::postmutate( AddressExpr *addrExpr ) {
-		assert( addrExpr->result );
-		addrExpr->set_arg( doSpecialization( addrExpr->result, addrExpr->arg ) );
-		return addrExpr;
-	}
-
 	Expression * Specialize::postmutate( CastExpr *castExpr ) {
 		if ( castExpr->result->isVoid() ) {
@@ -334,5 +325,5 @@
 			return castExpr;
 		}
-		Expression *specialized = doSpecialization( castExpr->result, castExpr->arg );
+		Expression *specialized = doSpecialization( castExpr->result, castExpr->arg, &castExpr->inferParams );
 		if ( specialized != castExpr->arg ) {
 			// assume here that the specialization incorporates the cast
