Index: src/GenPoly/ScrubTyVars.h
===================================================================
--- src/GenPoly/ScrubTyVars.h	(revision ebe9b3a3d574e360214e7e825ea7414a364d9b0e)
+++ src/GenPoly/ScrubTyVars.h	(revision c09e4bce3616f4b9a1eddefa98f8d4638ee3af85)
@@ -27,5 +27,5 @@
 	class ScrubTyVars : public Mutator {
 	  public:
-		ScrubTyVars( const TyVarMap &tyVars ): tyVars( tyVars ) {}
+		ScrubTyVars( const TyVarMap &tyVars, bool dynamicOnly = false ): tyVars( tyVars ), dynamicOnly( dynamicOnly ) {}
 
 		/// For all polymorphic types with type variables in `tyVars`, replaces generic types, dtypes, and ftypes with the appropriate void type,
@@ -33,4 +33,9 @@
 		template< typename SynTreeClass >
 		static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
+
+		/// For all dynamic-layout types with type variables in `tyVars`, replaces generic types, dtypes, and ftypes with the appropriate void type,
+		/// and sizeof/alignof expressions with the proper variable
+		template< typename SynTreeClass >
+		static SynTreeClass *scrubDynamic( SynTreeClass *target, const TyVarMap &tyVars );
 
 		virtual Type* mutate( TypeInstType *typeInst );
@@ -42,14 +47,32 @@
 
 	  private:
+		/// Returns the type if it should be scrubbed, NULL otherwise.
+		Type* shouldScrub( Type *ty ) {
+			return dynamicOnly ? isDynType( ty, tyVars ) : isPolyType( ty, tyVars );
+// 			if ( ! dynamicOnly ) return isPolyType( ty, tyVars );
+// 
+// 			if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( ty ) ) {
+// 				return tyVars.find( typeInst->get_name() ) != tyVars.end() ? ty : 0;
+// 			}
+// 
+// 			return isDynType( ty, tyVars );
+		}
+		
 		/// Mutates (possibly generic) aggregate types appropriately
 		Type* mutateAggregateType( Type *ty );
 		
-		const TyVarMap &tyVars;
+		const TyVarMap &tyVars;  ///< Type variables to scrub
+		bool dynamicOnly;        ///< only scrub the types with dynamic layout? [false]
 	};
 
-	/* static class method */
 	template< typename SynTreeClass >
 	SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
 		ScrubTyVars scrubber( tyVars );
+		return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
+	}
+
+	template< typename SynTreeClass >
+	SynTreeClass * ScrubTyVars::scrubDynamic( SynTreeClass *target, const TyVarMap &tyVars ) {
+		ScrubTyVars scrubber( tyVars, true );
 		return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
 	}
