Index: src/SynTree/TypeSubstitution.cc
===================================================================
--- src/SynTree/TypeSubstitution.cc	(revision 76f7fc734a09409f02e2b52d5645a0d39e9c567b)
+++ src/SynTree/TypeSubstitution.cc	(revision 7e895269c55ecce598dc4e83c68d2b412131ea50)
@@ -108,6 +108,7 @@
 namespace {
 	struct EnvTrimmer {
-		TypeSubstitution * env, * newEnv;
-		EnvTrimmer( TypeSubstitution * env, TypeSubstitution * newEnv ) : env( env ), newEnv( newEnv ){}
+		const TypeSubstitution * env;
+		TypeSubstitution * newEnv;
+		EnvTrimmer( const TypeSubstitution * env, TypeSubstitution * newEnv ) : env( env ), newEnv( newEnv ){}
 		void previsit( TypeDecl * tyDecl ) {
 			// transfer known bindings for seen type variables
@@ -120,5 +121,5 @@
 
 /// reduce environment to just the parts that are referenced in a given expression
-TypeSubstitution * TypeSubstitution::newFromExpr( Expression * expr, TypeSubstitution * env ) {
+TypeSubstitution * TypeSubstitution::newFromExpr( Expression * expr, const TypeSubstitution * env ) {
 	if ( env ) {
 		TypeSubstitution * newEnv = new TypeSubstitution();
Index: src/SynTree/TypeSubstitution.h
===================================================================
--- src/SynTree/TypeSubstitution.h	(revision 76f7fc734a09409f02e2b52d5645a0d39e9c567b)
+++ src/SynTree/TypeSubstitution.h	(revision 7e895269c55ecce598dc4e83c68d2b412131ea50)
@@ -39,6 +39,6 @@
 	TypeSubstitution &operator=( const TypeSubstitution &other );
 
-	template< typename SynTreeClass > int apply( SynTreeClass *&input );
-	template< typename SynTreeClass > int applyFree( SynTreeClass *&input );
+	template< typename SynTreeClass > int apply( SynTreeClass *&input ) const;
+	template< typename SynTreeClass > int applyFree( SynTreeClass *&input ) const;
 
 	void add( std::string formalType, Type *actualType );
@@ -56,5 +56,5 @@
 
 	/// create a new TypeSubstitution using bindings from env containing all of the type variables in expr
-	static TypeSubstitution * newFromExpr( Expression * expr, TypeSubstitution * env );
+	static TypeSubstitution * newFromExpr( Expression * expr, const TypeSubstitution * env );
 
 	void normalize();
@@ -130,5 +130,5 @@
 // definitition must happen after PassVisitor is included so that WithGuards can be used
 struct TypeSubstitution::Substituter : public WithGuards, public WithVisitorRef<Substituter> {
-		Substituter( TypeSubstitution & sub, bool freeOnly ) : sub( sub ), freeOnly( freeOnly ) {}
+		Substituter( const TypeSubstitution & sub, bool freeOnly ) : sub( sub ), freeOnly( freeOnly ) {}
 
 		Type * postmutate( TypeInstType * aggregateUseType );
@@ -143,5 +143,5 @@
 		void premutate( UnionInstType * aggregateUseType );
 
-		TypeSubstitution & sub;
+		const TypeSubstitution & sub;
 		int subCount = 0;
 		bool freeOnly;
@@ -151,5 +151,5 @@
 
 template< typename SynTreeClass >
-int TypeSubstitution::apply( SynTreeClass *&input ) {
+int TypeSubstitution::apply( SynTreeClass *&input ) const {
 	assert( input );
 	PassVisitor<Substituter> sub( *this, false );
@@ -163,5 +163,5 @@
 
 template< typename SynTreeClass >
-int TypeSubstitution::applyFree( SynTreeClass *&input ) {
+int TypeSubstitution::applyFree( SynTreeClass *&input ) const {
 	assert( input );
 	PassVisitor<Substituter> sub( *this, true );
